@hjmds/react 1.26.1 → 1.27.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/THIRD_PARTY_NOTICES.md +7 -0
- package/dist/advanced-display.d.ts +1 -0
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +3 -2
- package/dist/advanced-display.js.map +1 -1
- package/dist/agreement.d.ts.map +1 -1
- package/dist/agreement.js +2 -1
- package/dist/agreement.js.map +1 -1
- package/dist/bottom-cta.d.ts.map +1 -1
- package/dist/bottom-cta.js +5 -2
- package/dist/bottom-cta.js.map +1 -1
- package/dist/bottom-navigation.d.ts.map +1 -1
- package/dist/bottom-navigation.js +3 -0
- package/dist/bottom-navigation.js.map +1 -1
- package/dist/calendar.js +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/carousel-motion.d.ts.map +1 -1
- package/dist/carousel-motion.js +4 -3
- package/dist/carousel-motion.js.map +1 -1
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +3 -2
- package/dist/carousel.js.map +1 -1
- package/dist/chart.d.ts +3 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +9 -4
- package/dist/chart.js.map +1 -1
- package/dist/clipboard.d.ts +27 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +26 -12
- package/dist/clipboard.js.map +1 -1
- package/dist/collapsible.d.ts +9 -0
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +9 -2
- package/dist/collapsible.js.map +1 -1
- package/dist/collection-editing.d.ts.map +1 -1
- package/dist/collection-editing.js +15 -10
- package/dist/collection-editing.js.map +1 -1
- package/dist/collection-rail.d.ts.map +1 -1
- package/dist/collection-rail.js +3 -2
- package/dist/collection-rail.js.map +1 -1
- package/dist/communication.d.ts.map +1 -1
- package/dist/communication.js +5 -2
- package/dist/communication.js.map +1 -1
- package/dist/context-menu.d.ts +9 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/context-menu.js.map +1 -1
- package/dist/conversation-row.js +1 -1
- package/dist/conversation-row.js.map +1 -1
- package/dist/data-workflows.d.ts.map +1 -1
- package/dist/data-workflows.js +4 -3
- package/dist/data-workflows.js.map +1 -1
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +5 -3
- package/dist/date-picker.js.map +1 -1
- package/dist/design-profile.d.ts.map +1 -1
- package/dist/design-profile.js +4 -2
- package/dist/design-profile.js.map +1 -1
- package/dist/effect-surface.d.ts +9 -3
- package/dist/effect-surface.d.ts.map +1 -1
- package/dist/effect-surface.js +3 -2
- package/dist/effect-surface.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/evidence.js.map +1 -1
- package/dist/feedback.d.ts +8 -19
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +7 -3
- package/dist/feedback.js.map +1 -1
- package/dist/field-group.d.ts.map +1 -1
- package/dist/field-group.js +15 -8
- package/dist/field-group.js.map +1 -1
- package/dist/file-picker.d.ts +14 -2
- package/dist/file-picker.d.ts.map +1 -1
- package/dist/file-picker.js +5 -2
- package/dist/file-picker.js.map +1 -1
- package/dist/folder-preview.d.ts.map +1 -1
- package/dist/folder-preview.js +2 -2
- package/dist/folder-preview.js.map +1 -1
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +2 -1
- package/dist/forms.js.map +1 -1
- package/dist/image-choice.d.ts +30 -0
- package/dist/image-choice.d.ts.map +1 -0
- package/dist/image-choice.js +24 -0
- package/dist/image-choice.js.map +1 -0
- package/dist/image-comparison.d.ts.map +1 -1
- package/dist/image-comparison.js +2 -1
- package/dist/image-comparison.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/message-reactions.d.ts +28 -2
- package/dist/internal/message-reactions.d.ts.map +1 -1
- package/dist/internal/message-reactions.js +11 -4
- package/dist/internal/message-reactions.js.map +1 -1
- package/dist/internal/screen-exit.d.ts +11 -0
- package/dist/internal/screen-exit.d.ts.map +1 -0
- package/dist/internal/screen-exit.js +10 -0
- package/dist/internal/screen-exit.js.map +1 -0
- package/dist/internal/screen-footer.d.ts +7 -0
- package/dist/internal/screen-footer.d.ts.map +1 -0
- package/dist/internal/screen-footer.js +8 -0
- package/dist/internal/screen-footer.js.map +1 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +8 -4
- package/dist/layout.js.map +1 -1
- package/dist/masonry.d.ts +5 -3
- package/dist/masonry.d.ts.map +1 -1
- package/dist/masonry.js +25 -3
- package/dist/masonry.js.map +1 -1
- package/dist/menu-morph.d.ts.map +1 -1
- package/dist/menu-morph.js +30 -7
- package/dist/menu-morph.js.map +1 -1
- package/dist/overlays.d.ts +2 -0
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +48 -11
- package/dist/overlays.js.map +1 -1
- package/dist/popover.d.ts +6 -0
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +3 -3
- package/dist/popover.js.map +1 -1
- package/dist/qr-code.js +1 -1
- package/dist/qr-code.js.map +1 -1
- package/dist/reaction-picker.d.ts.map +1 -1
- package/dist/reaction-picker.js +14 -1
- package/dist/reaction-picker.js.map +1 -1
- package/dist/saved-items.d.ts +8 -2
- package/dist/saved-items.d.ts.map +1 -1
- package/dist/saved-items.js +4 -4
- package/dist/saved-items.js.map +1 -1
- package/dist/screen-flows.d.ts +52 -6
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +48 -19
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts +56 -8
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +41 -15
- package/dist/screens.js.map +1 -1
- package/dist/selection.d.ts.map +1 -1
- package/dist/selection.js +4 -4
- package/dist/selection.js.map +1 -1
- package/dist/social-compositions.d.ts.map +1 -1
- package/dist/social-compositions.js +3 -2
- package/dist/social-compositions.js.map +1 -1
- package/dist/sortable.d.ts.map +1 -1
- package/dist/sortable.js +9 -3
- package/dist/sortable.js.map +1 -1
- package/dist/status-text.d.ts.map +1 -1
- package/dist/status-text.js +5 -2
- package/dist/status-text.js.map +1 -1
- package/dist/styles.css +219 -126
- package/dist/styles.layered.css +219 -126
- package/dist/table-family.d.ts +1 -1
- package/dist/table-family.d.ts.map +1 -1
- package/dist/table-family.js +24 -7
- package/dist/table-family.js.map +1 -1
- package/dist/task-controls.d.ts.map +1 -1
- package/dist/task-controls.js +9 -4
- package/dist/task-controls.js.map +1 -1
- package/dist/task-list.d.ts +1 -1
- package/dist/task-list.d.ts.map +1 -1
- package/dist/task-list.js +4 -3
- package/dist/task-list.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +4 -0
- package/dist/theme.js.map +1 -1
- package/dist/top-bar.d.ts +5 -0
- package/dist/top-bar.d.ts.map +1 -1
- package/dist/top-bar.js +6 -1
- package/dist/top-bar.js.map +1 -1
- package/dist/transfer-list.d.ts.map +1 -1
- package/dist/transfer-list.js +13 -3
- package/dist/transfer-list.js.map +1 -1
- package/dist/upload-item.d.ts.map +1 -1
- package/dist/upload-item.js +3 -1
- package/dist/upload-item.js.map +1 -1
- package/fonts/pretendard/LICENSE.txt +94 -0
- package/fonts/pretendard/pretendard.css +927 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.0.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.1.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.10.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.11.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.12.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.13.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.14.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.15.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.16.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.17.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.18.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.19.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.2.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.20.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.21.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.22.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.23.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.24.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.25.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.26.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.27.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.28.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.29.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.3.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.30.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.31.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.32.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.33.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.34.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.35.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.36.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.37.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.38.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.39.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.4.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.40.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.41.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.42.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.43.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.44.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.45.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.46.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.47.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.48.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.49.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.5.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.50.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.51.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.52.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.53.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.54.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.55.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.56.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.57.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.58.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.59.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.6.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.60.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.61.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.62.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.63.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.64.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.65.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.66.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.67.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.68.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.69.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.7.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.70.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.71.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.72.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.73.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.74.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.75.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.76.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.77.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.78.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.79.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.8.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.80.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.81.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.82.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.83.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.84.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.85.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.86.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.87.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.88.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.89.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.9.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.90.woff2 +0 -0
- package/fonts/pretendard/woff2-dynamic-subset/PretendardVariable.subset.91.woff2 +0 -0
- package/package.json +10 -3
package/dist/clipboard.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { Button } from "./actions.js";
|
|
3
|
+
import { Button, IconButton } from "./actions.js";
|
|
4
|
+
import { Icon } from "./supplemental-display.js";
|
|
4
5
|
const defaultFeedbackDuration = 2000;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
* the temporary "copied" state, and announcing that state to a screen reader.
|
|
8
|
-
* The last one is the part that was always missing — a label that only changes
|
|
9
|
-
* visually tells a non-sighted user nothing happened.
|
|
10
|
-
*/
|
|
11
|
-
export const ClipboardButton = forwardRef(function ClipboardButton(
|
|
12
|
-
// Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the
|
|
13
|
-
// inherited Button default `primary` added a second primary to screens that already had one.
|
|
14
|
-
// Pass `tone="primary"` explicitly when copying *is* the screen's main action.
|
|
15
|
-
{ value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = "secondary", ...props }, forwardedRef) {
|
|
6
|
+
/** One copy state machine for the labelled and the icon presentation. */
|
|
7
|
+
function useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError }) {
|
|
16
8
|
const [copied, setCopied] = useState(false);
|
|
17
9
|
const [copying, setCopying] = useState(false);
|
|
18
10
|
const pending = useRef(false);
|
|
@@ -73,6 +65,28 @@ export const ClipboardButton = forwardRef(function ClipboardButton(
|
|
|
73
65
|
setCopying(false);
|
|
74
66
|
}
|
|
75
67
|
}, [value, feedbackDuration, onCopy, onCopyError]);
|
|
68
|
+
return { copied, copying, copy };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Copying is three things products kept re-deriving: the async clipboard call,
|
|
72
|
+
* the temporary "copied" state, and announcing that state to a screen reader.
|
|
73
|
+
* The last one is the part that was always missing — a label that only changes
|
|
74
|
+
* visually tells a non-sighted user nothing happened.
|
|
75
|
+
*/
|
|
76
|
+
export const ClipboardButton = forwardRef(function ClipboardButton(
|
|
77
|
+
// Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the
|
|
78
|
+
// inherited Button default `primary` added a second primary to screens that already had one.
|
|
79
|
+
// Pass `tone="primary"` explicitly when copying *is* the screen's main action.
|
|
80
|
+
{ value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = "secondary", ...props }, forwardedRef) {
|
|
81
|
+
const { copied, copying, copy } = useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError });
|
|
76
82
|
return (_jsxs(_Fragment, { children: [_jsx(Button, { ...props, tone: tone, loading: props.loading || copying, ref: forwardedRef, onClick: () => { void copy(); }, children: copied ? labels.copied : labels.idle }), _jsx("span", { role: "status", className: "hjm-visually-hidden", children: copied ? labels.copied : "" })] }));
|
|
77
83
|
});
|
|
84
|
+
/**
|
|
85
|
+
* Copy as a tool action (a code block or share-link header): an icon button named by the localized label, copy → check
|
|
86
|
+
* while the copied state lasts. A bordered text button there read as a form action (2026-10-17 review E10).
|
|
87
|
+
*/
|
|
88
|
+
export const ClipboardIconButton = forwardRef(function ClipboardIconButton({ value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = "ghost", ...props }, forwardedRef) {
|
|
89
|
+
const { copied, copying, copy } = useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError });
|
|
90
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { ...props, tone: tone, label: copied ? labels.copied : labels.idle, loading: props.loading || copying, ref: forwardedRef, onClick: () => { void copy(); }, children: _jsx(Icon, { name: copied ? "check" : "copy" }) }), _jsx("span", { role: "status", className: "hjm-visually-hidden", children: copied ? labels.copied : "" })] }));
|
|
91
|
+
});
|
|
78
92
|
//# sourceMappingURL=clipboard.js.map
|
package/dist/clipboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM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W,EAAE,CAAC,KAAK,CAAC,CAAC;QAC9E,CAAC;gBAAS,CAAC;YACT,2EAA2E;YAC3E,2EAA2E;YAC3E,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YACxB,IAAI,OAAO,CAAC,OAAO;gBAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAEnD,OAAO,CACL,8BACE,KAAC,MAAM,OAAK,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,YACjH,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAC9B,EAET,eAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,qBAAqB,YAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAQ,IACvF,CACJ,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"./actions.js\";\n\n// `onCopy` also names the DOM clipboard event handler on ButtonProps; intersected, the\n// value callback had to accept a ClipboardEvent too and no product could pass it. The\n// renderer consumes the prop and never forwards the DOM event, so omitting is lossless.\nexport type ClipboardButtonProps = Omit<ButtonProps, \"children\" | \"onClick\" | \"onCopy\"> &\n Readonly<{\n value: string;\n /** Localized copy for both states; the renderer invents neither. */\n labels: Readonly<{ idle: ReactNode; copied: ReactNode }>;\n /** How long the copied state stays, in ms. */\n feedbackDuration?: number;\n onCopy?: (value: string) => void;\n onCopyError?: (error: unknown) => void;\n }>;\n\nconst defaultFeedbackDuration = 2000;\n\n/**\n * Copying is three things products kept re-deriving: the async clipboard call,\n * the temporary \"copied\" state, and announcing that state to a screen reader.\n * The last one is the part that was always missing — a label that only changes\n * visually tells a non-sighted user nothing happened.\n */\nexport const ClipboardButton = forwardRef<HTMLButtonElement, ClipboardButtonProps>(\n function ClipboardButton(\n // Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the\n // inherited Button default `primary` added a second primary to screens that already had one.\n // Pass `tone=\"primary\"` explicitly when copying *is* the screen's main action.\n { value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = \"secondary\", ...props },\n forwardedRef,\n ) {\n const [copied, setCopied] = useState(false);\n const [copying, setCopying] = useState(false);\n const pending = useRef(false);\n const generation = useRef(0);\n const mounted = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => {\n mounted.current = true;\n setCopying(pending.current);\n return () => {\n mounted.current = false;\n generation.current += 1;\n if (timer.current !== undefined) clearTimeout(timer.current);\n };\n }, []);\n useEffect(() => {\n // A new value makes the previous \"copied\" claim false: it referred to the\n // old string, and leaving it up tells the user something untrue.\n generation.current += 1;\n setCopied(false);\n if (timer.current !== undefined) clearTimeout(timer.current);\n }, [value]);\n\n const copy = useCallback(async () => {\n // OS clipboard promises cannot be cancelled. A per-value generation ignores\n // obsolete feedback/callbacks instead of announcing an old source as copied.\n // A ref also closes the gap before React paints the unavailable busy button.\n if (!mounted.current || pending.current) return;\n const request = ++generation.current;\n pending.current = true;\n setCopying(true);\n setCopied(false);\n if (timer.current !== undefined) clearTimeout(timer.current);\n try {\n await navigator.clipboard.writeText(value);\n if (!mounted.current || request !== generation.current) return;\n setCopied(true);\n if (timer.current !== undefined) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), feedbackDuration);\n onCopy?.(value);\n } catch (error) {\n // Clipboard access can be denied; swallowing that would leave the user\n // believing the value was copied.\n if (mounted.current && request === generation.current) onCopyError?.(error);\n } finally {\n // Keep the OS write single-flight across value changes as well: starting a\n // second write early could let the first overwrite its clipboard contents.\n pending.current = false;\n if (mounted.current) setCopying(false);\n }\n }, [value, feedbackDuration, onCopy, onCopyError]);\n\n return (\n <>\n <Button {...props} tone={tone} loading={props.loading || copying} ref={forwardedRef} onClick={() => { void copy(); }}>\n {copied ? labels.copied : labels.idle}\n </Button>\n {/* The state change is announced, not only painted. */}\n <span role=\"status\" className=\"hjm-visually-hidden\">{copied ? labels.copied : \"\"}</span>\n </>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,UAAU,EAA0C,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAgBjD,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAIrC,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,EAAwB;IAC9F,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,MAAM,CAA4C,SAAS,CAAC,CAAC;IAC3E,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;QACvB,UAAU,CAAC,OAAO,CAAC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M,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAQ,IACvF,CACJ,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Button, IconButton, type ButtonProps, type IconButtonProps } from \"./actions.js\";\nimport { Icon } from \"./supplemental-display.js\";\n\n// `onCopy` also names the DOM clipboard event handler on ButtonProps; intersected, the\n// value callback had to accept a ClipboardEvent too and no product could pass it. The\n// renderer consumes the prop and never forwards the DOM event, so omitting is lossless.\nexport type ClipboardButtonProps = Omit<ButtonProps, \"children\" | \"onClick\" | \"onCopy\"> &\n Readonly<{\n value: string;\n /** Localized copy for both states; the renderer invents neither. */\n labels: Readonly<{ idle: ReactNode; copied: ReactNode }>;\n /** How long the copied state stays, in ms. */\n feedbackDuration?: number;\n onCopy?: (value: string) => void;\n onCopyError?: (error: unknown) => void;\n }>;\n\nconst defaultFeedbackDuration = 2000;\n\ntype ClipboardCopyOptions = Readonly<{ value: string; feedbackDuration: number; onCopy?: ((value: string) => void) | undefined; onCopyError?: ((error: unknown) => void) | undefined }>;\n\n/** One copy state machine for the labelled and the icon presentation. */\nfunction useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError }: ClipboardCopyOptions) {\n const [copied, setCopied] = useState(false);\n const [copying, setCopying] = useState(false);\n const pending = useRef(false);\n const generation = useRef(0);\n const mounted = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => {\n mounted.current = true;\n setCopying(pending.current);\n return () => {\n mounted.current = false;\n generation.current += 1;\n if (timer.current !== undefined) clearTimeout(timer.current);\n };\n }, []);\n useEffect(() => {\n // A new value makes the previous \"copied\" claim false: it referred to the\n // old string, and leaving it up tells the user something untrue.\n generation.current += 1;\n setCopied(false);\n if (timer.current !== undefined) clearTimeout(timer.current);\n }, [value]);\n\n const copy = useCallback(async () => {\n // OS clipboard promises cannot be cancelled. A per-value generation ignores\n // obsolete feedback/callbacks instead of announcing an old source as copied.\n // A ref also closes the gap before React paints the unavailable busy button.\n if (!mounted.current || pending.current) return;\n const request = ++generation.current;\n pending.current = true;\n setCopying(true);\n setCopied(false);\n if (timer.current !== undefined) clearTimeout(timer.current);\n try {\n await navigator.clipboard.writeText(value);\n if (!mounted.current || request !== generation.current) return;\n setCopied(true);\n if (timer.current !== undefined) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), feedbackDuration);\n onCopy?.(value);\n } catch (error) {\n // Clipboard access can be denied; swallowing that would leave the user\n // believing the value was copied.\n if (mounted.current && request === generation.current) onCopyError?.(error);\n } finally {\n // Keep the OS write single-flight across value changes as well: starting a\n // second write early could let the first overwrite its clipboard contents.\n pending.current = false;\n if (mounted.current) setCopying(false);\n }\n }, [value, feedbackDuration, onCopy, onCopyError]);\n\n return { copied, copying, copy };\n}\n\n\n/**\n * Copying is three things products kept re-deriving: the async clipboard call,\n * the temporary \"copied\" state, and announcing that state to a screen reader.\n * The last one is the part that was always missing — a label that only changes\n * visually tells a non-sighted user nothing happened.\n */\nexport const ClipboardButton = forwardRef<HTMLButtonElement, ClipboardButtonProps>(\n function ClipboardButton(\n // Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the\n // inherited Button default `primary` added a second primary to screens that already had one.\n // Pass `tone=\"primary\"` explicitly when copying *is* the screen's main action.\n { value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = \"secondary\", ...props },\n forwardedRef,\n ) {\n const { copied, copying, copy } = useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError });\n return (\n <>\n <Button {...props} tone={tone} loading={props.loading || copying} ref={forwardedRef} onClick={() => { void copy(); }}>\n {copied ? labels.copied : labels.idle}\n </Button>\n {/* The state change is announced, not only painted. */}\n <span role=\"status\" className=\"hjm-visually-hidden\">{copied ? labels.copied : \"\"}</span>\n </>\n );\n },\n);\n\nexport type ClipboardIconButtonProps = Omit<IconButtonProps, \"children\" | \"label\" | \"onClick\" | \"onCopy\" | \"selected\"> &\n Readonly<{\n value: string;\n /** Localized accessible names for both states; the icon carries no visible text. */\n labels: Readonly<{ idle: string; copied: string }>;\n feedbackDuration?: number;\n onCopy?: (value: string) => void;\n onCopyError?: (error: unknown) => void;\n }>;\n\n/**\n * Copy as a tool action (a code block or share-link header): an icon button named by the localized label, copy → check\n * while the copied state lasts. A bordered text button there read as a form action (2026-10-17 review E10).\n */\nexport const ClipboardIconButton = forwardRef<HTMLButtonElement, ClipboardIconButtonProps>(\n function ClipboardIconButton(\n { value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = \"ghost\", ...props },\n forwardedRef,\n ) {\n const { copied, copying, copy } = useClipboardCopy({ value, feedbackDuration, onCopy, onCopyError });\n return (\n <>\n <IconButton {...props} tone={tone} label={copied ? labels.copied : labels.idle} loading={props.loading || copying} ref={forwardedRef} onClick={() => { void copy(); }}>\n <Icon name={copied ? \"check\" : \"copy\"} />\n </IconButton>\n <span role=\"status\" className=\"hjm-visually-hidden\">{copied ? labels.copied : \"\"}</span>\n </>\n );\n },\n);\n"]}
|
package/dist/collapsible.d.ts
CHANGED
|
@@ -10,9 +10,18 @@ export type CollapsibleProps = CollapsibleOpenState & Readonly<{
|
|
|
10
10
|
presentation?: "disclosure" | "inline";
|
|
11
11
|
/** Preserve local input state while hidden; hidden content stays inaccessible. */
|
|
12
12
|
keepMounted?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* `none` leaves the open/closed mark to the trigger, which then places `CollapsibleMarker` itself — for triggers
|
|
15
|
+
* whose label is not a single row, where the end-aligned mark floated alone (FolderPreview, 2026-10-17 review).
|
|
16
|
+
*/
|
|
17
|
+
marker?: "end" | "none";
|
|
13
18
|
className?: string;
|
|
14
19
|
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
15
20
|
layoutStyle?: HjmCompositionStyleProp;
|
|
16
21
|
}>;
|
|
17
22
|
export declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
/** The decorative open/closed mark; the expanded state itself travels through the trigger's aria-expanded. */
|
|
24
|
+
export declare function CollapsibleMarker({ open }: Readonly<{
|
|
25
|
+
open: boolean;
|
|
26
|
+
}>): import("react").JSX.Element;
|
|
18
27
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAA4E,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAA4E,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,QAAQ,CAAC;IACP,oEAAoE;IACpE,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC;IACvC,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEL,eAAO,MAAM,WAAW,6GA6DtB,CAAC;AAEH,8GAA8G;AAC9G,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,+BAItE"}
|
package/dist/collapsible.js
CHANGED
|
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { collapsibleRecipe, validateCollapsibleOpenState, } from "@hjmds/design-contracts/components/collapsible";
|
|
3
3
|
import { forwardRef, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { assignRef, classNames } from "./internal.js";
|
|
5
|
-
|
|
5
|
+
import { Icon } from "./supplemental-display.js";
|
|
6
|
+
export const Collapsible = forwardRef(function Collapsible({ trigger, children, disabled = false, presentation = "disclosure", keepMounted = false, marker = "end", className, layoutStyle, ...openState }, forwardedRef) {
|
|
6
7
|
validateCollapsibleOpenState(openState);
|
|
7
8
|
const controlled = openState.open !== undefined;
|
|
8
9
|
const [internalOpen, setInternalOpen] = useState(openState.defaultOpen ?? false);
|
|
@@ -36,7 +37,13 @@ export const Collapsible = forwardRef(function Collapsible({ trigger, children,
|
|
|
36
37
|
if (!controlled)
|
|
37
38
|
setInternalOpen(next);
|
|
38
39
|
openState.onOpenChange?.(next);
|
|
39
|
-
}, children: [trigger,
|
|
40
|
+
}, children: [trigger, marker === "end" ? _jsx(CollapsibleMarker, { open: open }) : null] }), open || keepMounted ? (_jsx("div", { ref: content, onFocusCapture: () => { focusedContent.current = true; }, onBlurCapture: event => { if (event.relatedTarget instanceof Node && !event.currentTarget.contains(event.relatedTarget))
|
|
40
41
|
focusedContent.current = false; }, hidden: !open, id: `${id}-content`, role: "region", className: "hjm-collapsible__content", children: children })) : null] }));
|
|
41
42
|
});
|
|
43
|
+
/** The decorative open/closed mark; the expanded state itself travels through the trigger's aria-expanded. */
|
|
44
|
+
export function CollapsibleMarker({ open }) {
|
|
45
|
+
// The shared chevron at glyph.sm: the text "▸" rendered about 8px and read as static text (2026-10-17 review).
|
|
46
|
+
// `chevronEnd` is a logical icon, so Icon mirrors it in RTL.
|
|
47
|
+
return _jsx("span", { "aria-hidden": "true", className: "hjm-collapsible__marker", "data-state": open ? "open" : "closed", children: _jsx(Icon, { name: open ? "chevronDown" : "chevronEnd", size: "sm", tone: "secondary", decorative: true }) });
|
|
48
|
+
}
|
|
42
49
|
//# sourceMappingURL=collapsible.js.map
|
package/dist/collapsible.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAE7B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAE7B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAuBjD,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAmC,SAAS,WAAW,CAC1F,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE,WAAW,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,EAC/I,YAAY;IAEZ,4BAA4B,CAAC,SAAiC,CAAC,CAAC;IA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AAE,GAAG,EAAE,GAAG,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,GAAG,IAAI,KAAK,CAAC,aAAa,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;oBAAE,cAAc,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAO,CACjV,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,8GAA8G;AAC9G,MAAM,UAAU,iBAAiB,CAAC,EAAE,IAAI,EAA+B;IACrE,+GAA+G;IAC/G,6DAA6D;IAC7D,OAAO,8BAAkB,MAAM,EAAC,SAAS,EAAC,yBAAyB,gBAAa,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,YAAE,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,WAAW,EAAC,UAAU,SAAG,GAAO,CAAC;AAC7M,CAAC","sourcesContent":["import {\n collapsibleRecipe,\n validateCollapsibleOpenState,\n type CollapsibleOpenState,\n} from \"@hjmds/design-contracts/components/collapsible\";\nimport { forwardRef, useId, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { assignRef, classNames } from \"./internal.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CollapsibleProps = CollapsibleOpenState &\n Readonly<{\n /** The control's label; it also tells the user what will appear. */\n trigger: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n /** Inline tools stay expanded without a disclosure trigger. */\n presentation?: \"disclosure\" | \"inline\";\n /** Preserve local input state while hidden; hidden content stays inaccessible. */\n keepMounted?: boolean;\n /**\n * `none` leaves the open/closed mark to the trigger, which then places `CollapsibleMarker` itself — for triggers\n * whose label is not a single row, where the end-aligned mark floated alone (FolderPreview, 2026-10-17 review).\n */\n marker?: \"end\" | \"none\";\n className?: string;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { trigger, children, disabled = false, presentation = \"disclosure\", keepMounted = false, marker = \"end\", className, layoutStyle, ...openState },\n forwardedRef,\n) {\n validateCollapsibleOpenState(openState as CollapsibleOpenState);\n const controlled = openState.open !== undefined;\n const [internalOpen, setInternalOpen] = useState(openState.defaultOpen ?? false);\n const open = presentation === \"inline\" || (openState.open ?? internalOpen);\n const host = useRef<HTMLDivElement>(null);\n const button = useRef<HTMLButtonElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const focusedContent = useRef(false);\n const wasOpen = useRef(open);\n useLayoutEffect(() => {\n // A controlled close can remove or hide the currently focused input without\n // activating the trigger. Recover only that focus, never an outside control.\n const active = host.current?.ownerDocument.activeElement;\n if (wasOpen.current && !open && focusedContent.current &&\n (content.current?.contains(active ?? null) || active === host.current?.ownerDocument.body)) {\n (disabled ? host.current : button.current)?.focus();\n }\n if (!open) focusedContent.current = false;\n wasOpen.current = open;\n }, [open, disabled]);\n const id = `${useId().replaceAll(\":\", \"\")}-collapsible`;\n return (\n <div\n ref={node => { host.current = node; assignRef(forwardedRef, node); }}\n tabIndex={-1}\n className={classNames(\"hjm-collapsible\", className)}\n data-state={open ? \"open\" : \"closed\"}\n style={{ ...layoutStyle, \"--hjm-collapsible-gap\": `${collapsibleRecipe.gap}px` } as CSSProperties}\n >\n <button\n ref={button}\n hidden={presentation === \"inline\"}\n type=\"button\"\n className=\"hjm-collapsible__trigger\"\n aria-expanded={open}\n aria-controls={`${id}-content`}\n disabled={disabled}\n onClick={event => {\n if (disabled || presentation === \"inline\") return;\n // Safari does not focus buttons on pointer activation; keep the closing\n // disclosure as the keyboard origin before its focused content disappears.\n if (open) event.currentTarget.focus();\n const next = !open;\n if (!controlled) setInternalOpen(next);\n openState.onOpenChange?.(next);\n }}\n >\n {trigger}\n {marker === \"end\" ? <CollapsibleMarker open={open} /> : null}\n </button>\n {/* Optional persistence keeps theme changes and closing tools from erasing local\n drafts. The HTML hidden boundary removes closed content from focus and speech. */}\n {open || keepMounted ? (\n <div ref={content} onFocusCapture={() => { focusedContent.current = true; }} onBlurCapture={event => { if (event.relatedTarget instanceof Node && !event.currentTarget.contains(event.relatedTarget)) focusedContent.current = false; }} hidden={!open} id={`${id}-content`} role=\"region\" className=\"hjm-collapsible__content\">{children}</div>\n ) : null}\n </div>\n );\n});\n\n/** The decorative open/closed mark; the expanded state itself travels through the trigger's aria-expanded. */\nexport function CollapsibleMarker({ open }: Readonly<{ open: boolean }>) {\n // The shared chevron at glyph.sm: the text \"▸\" rendered about 8px and read as static text (2026-10-17 review).\n // `chevronEnd` is a logical icon, so Icon mirrors it in RTL.\n return <span aria-hidden=\"true\" className=\"hjm-collapsible__marker\" data-state={open ? \"open\" : \"closed\"}><Icon name={open ? \"chevronDown\" : \"chevronEnd\"} size=\"sm\" tone=\"secondary\" decorative /></span>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-editing.d.ts","sourceRoot":"","sources":["../src/collection-editing.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"collection-editing.d.ts","sourceRoot":"","sources":["../src/collection-editing.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,EAA8H,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,KA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C;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BASxD;AAED,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACrE,YAAY,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,CAAC;IAC/F,eAAe,EAAE,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,KAAK,IAAI,CAAC;CAC9D,CAAC,CAAC;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,+BAgBlE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { useCompositionAction } from "./internal/use-composition-action.js";
|
|
5
5
|
import { assertDistinctIds, changeColumnSettings, collectionEditingRecipe, focusAfterRemoval, recoverableFilters, snapshotSelection } from "@hjmds/design-contracts/collection-editing";
|
|
6
|
-
import { Button } from "./actions.js";
|
|
6
|
+
import { Button, IconButton } from "./actions.js";
|
|
7
|
+
import { Icon } from "./supplemental-display.js";
|
|
7
8
|
import { TextField } from "./forms.js";
|
|
8
9
|
import { Checkbox } from "./selection.js";
|
|
9
10
|
import { Stack, Text } from "./layout.js";
|
|
@@ -37,7 +38,7 @@ function InlineEditBody(props) {
|
|
|
37
38
|
if (result.status === "success")
|
|
38
39
|
close();
|
|
39
40
|
};
|
|
40
|
-
return _jsx("div", { ref: group, role: "group", "aria-label": props.label, children: !editing ? _jsxs(Stack, { axis: "inline", gap: "sm", align: "center",
|
|
41
|
+
return _jsx("div", { ref: group, role: "group", "aria-label": props.label, children: !editing ? _jsxs(Stack, { axis: "inline", gap: "sm", align: "center", children: [_jsxs(Stack, { gap: "xxs", layoutStyle: { flex: 1, minInlineSize: 0 }, children: [_jsx(Text, { variant: "caption", tone: "muted", children: props.label }), _jsx(Text, { emphasis: "strong", children: props.value })] }), _jsx(IconButton, { ref: trigger, label: props.editLabel, tone: "ghost", disabled: props.disabled ?? false, onClick: () => { setDraft(props.value); action.session.reset(null); setEditing(true); }, children: _jsx(Icon, { name: "edit" }) })] })
|
|
41
42
|
: _jsxs(Stack, { gap: collectionEditingRecipe.actionGap, children: [_jsx(TextField, { ref: input, label: props.label, value: draft, disabled: props.disabled ?? false, readOnly: action.pending, ...(error ? { error, "aria-invalid": true } : {}), onValueChange: setDraft, onKeyDown: event => {
|
|
42
43
|
// Enter during IME composition confirms a character, not the title.
|
|
43
44
|
if (event.nativeEvent.isComposing || event.keyCode === 229)
|
|
@@ -72,16 +73,16 @@ export function RepeatableFieldGroup({ renderField, addLabel, removeLabel, minFi
|
|
|
72
73
|
const live = useRef(true), policy = useRef({ fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled });
|
|
73
74
|
policy.current = { fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled };
|
|
74
75
|
useEffect(() => { live.current = true; return () => { live.current = false; }; }, []);
|
|
75
|
-
return _jsxs(Stack, { gap: collectionEditingRecipe.gap, children: [_jsx(FieldGroup, { ...props, renderField: binding => _jsxs(Stack, { gap: "
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
return _jsxs(Stack, { gap: collectionEditingRecipe.gap, children: [_jsx(FieldGroup, { ...props, renderField: binding => _jsxs(Stack, { axis: "inline", gap: "xs", align: "end", children: [_jsx("div", { style: { flex: 1, minInlineSize: 0 }, children: renderField({ ...binding, focusRef: target => { if (target)
|
|
77
|
+
targets.current.set(binding.id, target);
|
|
78
|
+
else
|
|
79
|
+
targets.current.delete(binding.id); } }) }), _jsx(IconButton, { label: removeLabel(binding.id), tone: "ghost", disabled: binding.controlProps.disabled || fields.length <= minFields, onClick: binding.guardChange(() => {
|
|
79
80
|
const current = policy.current;
|
|
80
81
|
if (!live.current || current.disabled || current.fields.length <= current.minFields)
|
|
81
82
|
return;
|
|
82
83
|
focus.current = focusAfterRemoval(current.fields.map(field => field.id), binding.id, current.fields.filter(field => field.disabled).map(field => field.id)) ?? null;
|
|
83
84
|
current.onRemove(binding.id);
|
|
84
|
-
}), children:
|
|
85
|
+
}), children: _jsx(Icon, { name: "delete" }) })] }) }), _jsx(Button, { ref: add, tone: "secondary", disabled: props.descriptor.disabled === true || fields.length >= maxFields, onClick: () => {
|
|
85
86
|
const current = policy.current;
|
|
86
87
|
if (!live.current || current.disabled || current.fields.length >= current.maxFields)
|
|
87
88
|
return;
|
|
@@ -109,7 +110,8 @@ export function SelectionActionBar(props) {
|
|
|
109
110
|
}
|
|
110
111
|
export function FilterRecovery(props) {
|
|
111
112
|
const action = useCompositionAction(props.disabled), options = recoverableFilters(props.options);
|
|
112
|
-
|
|
113
|
+
// Fills the result area its host gives it (flex parent) and centers there, like Native.
|
|
114
|
+
return _jsx("div", { role: "group", "aria-label": props.title, style: { display: "grid", placeItems: "center", flexGrow: 1, textAlign: "center" }, children: _jsxs(Stack, { gap: "sm", align: "center", children: [_jsx(Text, { emphasis: "strong", children: props.title }), props.description ? _jsx(Text, { tone: "muted", children: props.description }) : null, options.map(option => _jsx(Button, { tone: "secondary", loading: action.active === option.id, disabled: props.disabled === true || (action.pending && action.active !== option.id), onClick: () => { if (!props.disabled)
|
|
113
115
|
void action.run(option.id, () => props.onApply(option.id)); }, children: props.optionLabel(option) }, option.id)), action.failed ? _jsx(ErrorMessage, { children: props.errorLabel }) : null] }) });
|
|
114
116
|
}
|
|
115
117
|
export function TableColumnSettings(props) {
|
|
@@ -121,6 +123,9 @@ export function TableColumnSettings(props) {
|
|
|
121
123
|
if (next !== props.columns)
|
|
122
124
|
props.onColumnsChange(next);
|
|
123
125
|
};
|
|
124
|
-
|
|
126
|
+
const labelId = useId(), disabled = props.disabled === true;
|
|
127
|
+
// One row per column: visibility checkbox, then reorder as icon tools (labels stay the accessible names).
|
|
128
|
+
// The group label is HJM Text like Native; a browser-default <legend> rendered differently (2026-10-17 review).
|
|
129
|
+
return _jsxs(Stack, { gap: "sm", role: "group", "aria-labelledby": labelId, children: [_jsx(Text, { id: labelId, emphasis: "strong", children: props.label }), props.columns.map(column => _jsxs(Stack, { axis: "inline", gap: "xs", align: "center", children: [_jsx(Checkbox, { label: column.label, checked: column.visible, layoutStyle: { flex: 1, minInlineSize: 0 }, disabled: disabled || column.locked === true || (column.visible && props.columns.filter(item => item.visible).length === 1), onCheckedChange: () => change(column.id, "toggle") }), _jsx(IconButton, { label: props.earlierLabel(column), tone: "ghost", disabled: disabled || changeColumnSettings(props.columns, column.id, "earlier") === props.columns, onClick: () => change(column.id, "earlier"), children: _jsx(Icon, { name: "chevronUp" }) }), _jsx(IconButton, { label: props.laterLabel(column), tone: "ghost", disabled: disabled || changeColumnSettings(props.columns, column.id, "later") === props.columns, onClick: () => change(column.id, "later"), children: _jsx(Icon, { name: "chevronDown" }) })] }, column.id))] });
|
|
125
130
|
}
|
|
126
131
|
//# sourceMappingURL=collection-editing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-editing.js","sourceRoot":"","sources":["../src/collection-editing.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAyF,MAAM,4CAA4C,CAAC;AAC/Q,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAA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CAAC,EAAE,EAAE,QAAQ,CAAC,GAAI,EAC/N,MAAC,KAAK,IAAC,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,IAAI,mBAAC,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,YAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GAAU,EAC/N,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,YAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,GAAU,IAAQ,KAH3J,MAAM,CAAC,EAAE,CAI1C,CAAC,GACH,IAAW,CAAC;AACtB,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { useCompositionAction } from \"./internal/use-composition-action.js\";\nimport { assertDistinctIds, changeColumnSettings, collectionEditingRecipe, focusAfterRemoval, recoverableFilters, snapshotSelection, type ColumnSetting, type FilterRecoveryOption, type FocusTarget, type SelectionAction } from \"@hjmds/design-contracts/collection-editing\";\nimport { Button } from \"./actions.js\";\nimport { TextField } from \"./forms.js\";\nimport { Checkbox } from \"./selection.js\";\nimport { Stack, Text } from \"./layout.js\";\nimport { FieldGroup, type FieldGroupBinding, type FieldGroupProps } from \"./field-group.js\";\n\n\nfunction ErrorMessage({ children }: { children: ReactNode }) {\n return <div role=\"alert\" style={{ display: \"grid\", placeItems: \"center\", textAlign: \"center\" }}><Text tone=\"danger\">{children}</Text></div>;\n}\n\nexport type InlineEditProps = Readonly<{\n id: string; value: string; label: string; editLabel: string; saveLabel: string; cancelLabel: string; errorLabel: string;\n disabled?: boolean; validate?: (draft: string) => string | undefined;\n /** Resolve only after confirming and updating the product value; reject to preserve the draft. */\n onSave: (draft: string) => void | Promise<void>;\n}>;\nexport function InlineEdit(props: InlineEditProps) { return <InlineEditBody key={props.id} {...props} />; }\nfunction InlineEditBody(props: InlineEditProps) {\n const [editing, setEditing] = useState(false), [draft, setDraft] = useState(props.value);\n const action = useCompositionAction(props.disabled);\n const input = useRef<HTMLInputElement>(null), trigger = useRef<HTMLButtonElement>(null), group = useRef<HTMLDivElement>(null);\n const restore = useRef(false);\n useLayoutEffect(() => {\n if (editing) input.current?.focus();\n else if (restore.current) { restore.current = false; trigger.current?.focus(); }\n }, [editing]);\n const error = props.validate?.(draft);\n const close = () => {\n restore.current = group.current?.contains(document.activeElement) ?? false;\n setEditing(false);\n };\n const save = async () => {\n if (props.disabled || error || action.pending || action.session.getSnapshot().status === \"pending\") return;\n const result = await action.run(\"save\", () => props.onSave(draft));\n if (result.status === \"success\") close();\n };\n return <div ref={group} role=\"group\" aria-label={props.label}>\n {!editing ? <Stack axis=\"inline\" gap=\"sm\" align=\"center\" wrap><Text>{props.value}</Text><Button ref={trigger} disabled={props.disabled ?? false} tone=\"ghost\" onClick={() => { setDraft(props.value); action.session.reset(null); setEditing(true); }}>{props.editLabel}</Button></Stack>\n : <Stack gap={collectionEditingRecipe.actionGap}>\n <TextField ref={input} label={props.label} value={draft} disabled={props.disabled ?? false} readOnly={action.pending}\n {...(error ? { error, \"aria-invalid\": true } : {})} onValueChange={setDraft}\n onKeyDown={event => {\n // Enter during IME composition confirms a character, not the title.\n if (event.nativeEvent.isComposing || event.keyCode === 229) return;\n if (event.key === \"Enter\") { event.preventDefault(); void save(); }\n if (event.key === \"Escape\" && !action.pending) { event.preventDefault(); event.stopPropagation(); close(); }\n }} />\n <Stack axis=\"inline\" gap=\"sm\" wrap><Button tone=\"ghost\" disabled={action.pending} onClick={close}>{props.cancelLabel}</Button>\n <Button loading={action.pending} disabled={props.disabled === true || !!error} onClick={() => void save()}>{props.saveLabel}</Button></Stack>\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack>}\n </div>;\n}\n\nexport type RepeatableFieldGroupProps = Omit<FieldGroupProps, \"renderField\"> & Readonly<{\n renderField: (binding: FieldGroupBinding & { focusRef: (target: FocusTarget | null) => void }) => ReactNode;\n addLabel: string; removeLabel: (id: string) => string; minFields?: number; maxFields?: number;\n /** Return the new stable id to focus after the controlled descriptor includes it. */\n onAdd: () => string | undefined; onRemove: (id: string) => void;\n}>;\nexport function RepeatableFieldGroup({ renderField, addLabel, removeLabel, minFields = 0, maxFields = Infinity, onAdd, onRemove, ...props }: RepeatableFieldGroupProps) {\n const targets = useRef(new Map<string, FocusTarget>()), add = useRef<HTMLButtonElement>(null);\n const focus = useRef<string | null | undefined>(undefined);\n useLayoutEffect(() => {\n if (focus.current === undefined) return;\n if (focus.current === null) { add.current?.focus(); focus.current = undefined; }\n else if (targets.current.has(focus.current)) { targets.current.get(focus.current)?.focus(); focus.current = undefined; }\n });\n const fields = props.descriptor.fields;\n const live = useRef(true), policy = useRef({ fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled });\n policy.current = { fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled };\n useEffect(() => { live.current = true; return () => { live.current = false; }; }, []);\n return <Stack gap={collectionEditingRecipe.gap}>\n <FieldGroup {...props} renderField={binding => <Stack gap=\"sm\">\n {renderField({ ...binding, focusRef: target => { if (target) targets.current.set(binding.id, target); else targets.current.delete(binding.id); } })}\n <Button tone=\"ghost\" disabled={binding.controlProps.disabled || fields.length <= minFields} onClick={binding.guardChange(() => {\n const current = policy.current;\n if (!live.current || current.disabled || current.fields.length <= current.minFields) return;\n focus.current = focusAfterRemoval(current.fields.map(field => field.id), binding.id, current.fields.filter(field => field.disabled).map(field => field.id)) ?? null;\n current.onRemove(binding.id);\n })}>{removeLabel(binding.id)}</Button>\n </Stack>} />\n <Button ref={add} tone=\"secondary\" disabled={props.descriptor.disabled === true || fields.length >= maxFields} onClick={() => {\n const current = policy.current;\n if (!live.current || current.disabled || current.fields.length >= current.maxFields) return;\n const id = current.onAdd(); if (id !== undefined) focus.current = id;\n }}>{addLabel}</Button>\n </Stack>;\n}\n\nexport type SelectionActionBarProps = Readonly<{\n selectedIds: readonly string[]; selectionLabel: (count: number) => string;\n clearLabel: string; onClear: () => void; actions: readonly SelectionAction[];\n onAction: (actionId: string, selectedIds: readonly string[]) => void | Promise<void>; errorLabel: string; disabled?: boolean;\n /** Product supplies the exact confirmed operation to undo; never restore an entire collection. */\n recovery?: Readonly<{ label: string; onUndo: () => void | Promise<void> }>;\n}>;\nexport function SelectionActionBar(props: SelectionActionBarProps) {\n const action = useCompositionAction(props.disabled);\n assertDistinctIds(props.actions); snapshotSelection(props.selectedIds);\n if (!props.selectedIds.length && !props.recovery && !action.pending && !action.failed) return null;\n return <div role=\"group\" aria-label={props.selectionLabel(props.selectedIds.length)}><Stack gap=\"sm\">\n <Text role=\"status\">{props.selectionLabel(props.selectedIds.length)}</Text>\n <Stack axis=\"inline\" gap=\"sm\" wrap>\n {props.actions.map(item => <Button key={item.id} tone={item.destructive ? \"danger\" : \"secondary\"} loading={action.active === `action:${item.id}`} disabled={props.disabled === true || (action.pending && action.active !== `action:${item.id}`) || !props.selectedIds.length} onClick={() => {\n if (props.disabled) return;\n const scope = snapshotSelection(props.selectedIds);\n if (scope.length) void action.run(`action:${item.id}`, () => props.onAction(item.id, scope));\n }}>{item.label}</Button>)}\n <Button tone=\"ghost\" disabled={props.disabled === true || action.pending || !props.selectedIds.length} onClick={props.onClear}>{props.clearLabel}</Button>\n {props.recovery ? <Button tone=\"ghost\" loading={action.active === \"undo\"} disabled={props.disabled === true || (action.pending && action.active !== \"undo\")} onClick={() => {\n if (!props.disabled) void action.run(\"undo\", () => props.recovery!.onUndo());\n }}>{props.recovery.label}</Button> : null}\n </Stack>\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack></div>;\n}\n\nexport type FilterRecoveryProps = Readonly<{\n title: string; description?: string; options: readonly FilterRecoveryOption[];\n optionLabel: (option: FilterRecoveryOption) => string; onApply: (id: string) => void | Promise<void>;\n errorLabel: string; disabled?: boolean;\n}>;\nexport function FilterRecovery(props: FilterRecoveryProps) {\n const action = useCompositionAction(props.disabled), options = recoverableFilters(props.options);\n return <div role=\"group\" aria-label={props.title} style={{ display: \"grid\", placeItems: \"center\", textAlign: \"center\" }}><Stack gap=\"sm\" align=\"center\">\n <Text emphasis=\"strong\">{props.title}</Text>{props.description ? <Text tone=\"muted\">{props.description}</Text> : null}\n {options.map(option => <Button key={option.id} tone=\"secondary\" loading={action.active === option.id} disabled={props.disabled === true || (action.pending && action.active !== option.id)}\n onClick={() => { if (!props.disabled) void action.run(option.id, () => props.onApply(option.id)); }}>{props.optionLabel(option)}</Button>)}\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack></div>;\n}\n\nexport type TableColumnSettingsProps = Readonly<{\n label: string; columns: readonly ColumnSetting[]; disabled?: boolean;\n earlierLabel: (column: ColumnSetting) => string; laterLabel: (column: ColumnSetting) => string;\n onColumnsChange: (columns: readonly ColumnSetting[]) => void;\n}>;\nexport function TableColumnSettings(props: TableColumnSettingsProps) {\n assertDistinctIds(props.columns);\n const change = (id: string, kind: \"toggle\" | \"earlier\" | \"later\") => {\n if (props.disabled) return;\n const next = changeColumnSettings(props.columns, id, kind); if (next !== props.columns) props.onColumnsChange(next);\n };\n return <fieldset disabled={props.disabled} style={{ margin: 0, padding: 0, border: 0, minInlineSize: 0 }}><legend>{props.label}</legend><Stack gap=\"sm\">\n {props.columns.map(column => <Stack key={column.id} gap=\"sm\">\n <Checkbox label={column.label} checked={column.visible} disabled={column.locked === true || (column.visible && props.columns.filter(item => item.visible).length === 1)} onCheckedChange={() => change(column.id, \"toggle\")} />\n <Stack axis=\"inline\" gap=\"sm\" wrap><Button tone=\"ghost\" disabled={changeColumnSettings(props.columns, column.id, \"earlier\") === props.columns} onClick={() => change(column.id, \"earlier\")}>{props.earlierLabel(column)}</Button>\n <Button tone=\"ghost\" disabled={changeColumnSettings(props.columns, column.id, \"later\") === props.columns} onClick={() => change(column.id, \"later\")}>{props.laterLabel(column)}</Button></Stack>\n </Stack>)}\n </Stack></fieldset>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collection-editing.js","sourceRoot":"","sources":["../src/collection-editing.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAyF,MAAM,4CAA4C,CAAC;AAC/Q,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAgD,MAAM,kBAAkB,CAAC;AAG5F,SAAS,YAAY,CAAC,EAAE,QAAQ,EAA2B;IACzD,OAAO,cAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAA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\nimport { useCompositionAction } from \"./internal/use-composition-action.js\";\nimport { assertDistinctIds, changeColumnSettings, collectionEditingRecipe, focusAfterRemoval, recoverableFilters, snapshotSelection, type ColumnSetting, type FilterRecoveryOption, type FocusTarget, type SelectionAction } from \"@hjmds/design-contracts/collection-editing\";\nimport { Button, IconButton } from \"./actions.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { TextField } from \"./forms.js\";\nimport { Checkbox } from \"./selection.js\";\nimport { Stack, Text } from \"./layout.js\";\nimport { FieldGroup, type FieldGroupBinding, type FieldGroupProps } from \"./field-group.js\";\n\n\nfunction ErrorMessage({ children }: { children: ReactNode }) {\n return <div role=\"alert\" style={{ display: \"grid\", placeItems: \"center\", textAlign: \"center\" }}><Text tone=\"danger\">{children}</Text></div>;\n}\n\nexport type InlineEditProps = Readonly<{\n id: string; value: string; label: string; editLabel: string; saveLabel: string; cancelLabel: string; errorLabel: string;\n disabled?: boolean; validate?: (draft: string) => string | undefined;\n /** Resolve only after confirming and updating the product value; reject to preserve the draft. */\n onSave: (draft: string) => void | Promise<void>;\n}>;\nexport function InlineEdit(props: InlineEditProps) { return <InlineEditBody key={props.id} {...props} />; }\nfunction InlineEditBody(props: InlineEditProps) {\n const [editing, setEditing] = useState(false), [draft, setDraft] = useState(props.value);\n const action = useCompositionAction(props.disabled);\n const input = useRef<HTMLInputElement>(null), trigger = useRef<HTMLButtonElement>(null), group = useRef<HTMLDivElement>(null);\n const restore = useRef(false);\n useLayoutEffect(() => {\n if (editing) input.current?.focus();\n else if (restore.current) { restore.current = false; trigger.current?.focus(); }\n }, [editing]);\n const error = props.validate?.(draft);\n const close = () => {\n restore.current = group.current?.contains(document.activeElement) ?? false;\n setEditing(false);\n };\n const save = async () => {\n if (props.disabled || error || action.pending || action.session.getSnapshot().status === \"pending\") return;\n const result = await action.run(\"save\", () => props.onSave(draft));\n if (result.status === \"success\") close();\n };\n return <div ref={group} role=\"group\" aria-label={props.label}>\n {/* Read state names the value with its label and edits through a pencil tool at the row end; a bare value beside a\n text \"제목 수정\" button lost the label (2026-10-17 review). */}\n {!editing ? <Stack axis=\"inline\" gap=\"sm\" align=\"center\">\n <Stack gap=\"xxs\" layoutStyle={{ flex: 1, minInlineSize: 0 }}><Text variant=\"caption\" tone=\"muted\">{props.label}</Text><Text emphasis=\"strong\">{props.value}</Text></Stack>\n <IconButton ref={trigger} label={props.editLabel} tone=\"ghost\" disabled={props.disabled ?? false} onClick={() => { setDraft(props.value); action.session.reset(null); setEditing(true); }}><Icon name=\"edit\" /></IconButton>\n </Stack>\n : <Stack gap={collectionEditingRecipe.actionGap}>\n <TextField ref={input} label={props.label} value={draft} disabled={props.disabled ?? false} readOnly={action.pending}\n {...(error ? { error, \"aria-invalid\": true } : {})} onValueChange={setDraft}\n onKeyDown={event => {\n // Enter during IME composition confirms a character, not the title.\n if (event.nativeEvent.isComposing || event.keyCode === 229) return;\n if (event.key === \"Enter\") { event.preventDefault(); void save(); }\n if (event.key === \"Escape\" && !action.pending) { event.preventDefault(); event.stopPropagation(); close(); }\n }} />\n <Stack axis=\"inline\" gap=\"sm\" wrap><Button tone=\"ghost\" disabled={action.pending} onClick={close}>{props.cancelLabel}</Button>\n <Button loading={action.pending} disabled={props.disabled === true || !!error} onClick={() => void save()}>{props.saveLabel}</Button></Stack>\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack>}\n </div>;\n}\n\nexport type RepeatableFieldGroupProps = Omit<FieldGroupProps, \"renderField\"> & Readonly<{\n renderField: (binding: FieldGroupBinding & { focusRef: (target: FocusTarget | null) => void }) => ReactNode;\n addLabel: string; removeLabel: (id: string) => string; minFields?: number; maxFields?: number;\n /** Return the new stable id to focus after the controlled descriptor includes it. */\n onAdd: () => string | undefined; onRemove: (id: string) => void;\n}>;\nexport function RepeatableFieldGroup({ renderField, addLabel, removeLabel, minFields = 0, maxFields = Infinity, onAdd, onRemove, ...props }: RepeatableFieldGroupProps) {\n const targets = useRef(new Map<string, FocusTarget>()), add = useRef<HTMLButtonElement>(null);\n const focus = useRef<string | null | undefined>(undefined);\n useLayoutEffect(() => {\n if (focus.current === undefined) return;\n if (focus.current === null) { add.current?.focus(); focus.current = undefined; }\n else if (targets.current.has(focus.current)) { targets.current.get(focus.current)?.focus(); focus.current = undefined; }\n });\n const fields = props.descriptor.fields;\n const live = useRef(true), policy = useRef({ fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled });\n policy.current = { fields, minFields, maxFields, onAdd, onRemove, disabled: props.descriptor.disabled };\n useEffect(() => { live.current = true; return () => { live.current = false; }; }, []);\n return <Stack gap={collectionEditingRecipe.gap}>\n {/* Remove is a row tool: a trash IconButton at the field's end whose label names the row (icon-button.md), not a\n full-width ghost text button under the field (2026-10-17 review). End-aligned so it sits beside the input. */}\n <FieldGroup {...props} renderField={binding => <Stack axis=\"inline\" gap=\"xs\" align=\"end\">\n <div style={{ flex: 1, minInlineSize: 0 }}>{renderField({ ...binding, focusRef: target => { if (target) targets.current.set(binding.id, target); else targets.current.delete(binding.id); } })}</div>\n <IconButton label={removeLabel(binding.id)} tone=\"ghost\" disabled={binding.controlProps.disabled || fields.length <= minFields} onClick={binding.guardChange(() => {\n const current = policy.current;\n if (!live.current || current.disabled || current.fields.length <= current.minFields) return;\n focus.current = focusAfterRemoval(current.fields.map(field => field.id), binding.id, current.fields.filter(field => field.disabled).map(field => field.id)) ?? null;\n current.onRemove(binding.id);\n })}><Icon name=\"delete\" /></IconButton>\n </Stack>} />\n <Button ref={add} tone=\"secondary\" disabled={props.descriptor.disabled === true || fields.length >= maxFields} onClick={() => {\n const current = policy.current;\n if (!live.current || current.disabled || current.fields.length >= current.maxFields) return;\n const id = current.onAdd(); if (id !== undefined) focus.current = id;\n }}>{addLabel}</Button>\n </Stack>;\n}\n\nexport type SelectionActionBarProps = Readonly<{\n selectedIds: readonly string[]; selectionLabel: (count: number) => string;\n clearLabel: string; onClear: () => void; actions: readonly SelectionAction[];\n onAction: (actionId: string, selectedIds: readonly string[]) => void | Promise<void>; errorLabel: string; disabled?: boolean;\n /** Product supplies the exact confirmed operation to undo; never restore an entire collection. */\n recovery?: Readonly<{ label: string; onUndo: () => void | Promise<void> }>;\n}>;\nexport function SelectionActionBar(props: SelectionActionBarProps) {\n const action = useCompositionAction(props.disabled);\n assertDistinctIds(props.actions); snapshotSelection(props.selectedIds);\n if (!props.selectedIds.length && !props.recovery && !action.pending && !action.failed) return null;\n return <div role=\"group\" aria-label={props.selectionLabel(props.selectedIds.length)}><Stack gap=\"sm\">\n <Text role=\"status\">{props.selectionLabel(props.selectedIds.length)}</Text>\n <Stack axis=\"inline\" gap=\"sm\" wrap>\n {props.actions.map(item => <Button key={item.id} tone={item.destructive ? \"danger\" : \"secondary\"} loading={action.active === `action:${item.id}`} disabled={props.disabled === true || (action.pending && action.active !== `action:${item.id}`) || !props.selectedIds.length} onClick={() => {\n if (props.disabled) return;\n const scope = snapshotSelection(props.selectedIds);\n if (scope.length) void action.run(`action:${item.id}`, () => props.onAction(item.id, scope));\n }}>{item.label}</Button>)}\n <Button tone=\"ghost\" disabled={props.disabled === true || action.pending || !props.selectedIds.length} onClick={props.onClear}>{props.clearLabel}</Button>\n {props.recovery ? <Button tone=\"ghost\" loading={action.active === \"undo\"} disabled={props.disabled === true || (action.pending && action.active !== \"undo\")} onClick={() => {\n if (!props.disabled) void action.run(\"undo\", () => props.recovery!.onUndo());\n }}>{props.recovery.label}</Button> : null}\n </Stack>\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack></div>;\n}\n\nexport type FilterRecoveryProps = Readonly<{\n title: string; description?: string; options: readonly FilterRecoveryOption[];\n optionLabel: (option: FilterRecoveryOption) => string; onApply: (id: string) => void | Promise<void>;\n errorLabel: string; disabled?: boolean;\n}>;\nexport function FilterRecovery(props: FilterRecoveryProps) {\n const action = useCompositionAction(props.disabled), options = recoverableFilters(props.options);\n // Fills the result area its host gives it (flex parent) and centers there, like Native.\n return <div role=\"group\" aria-label={props.title} style={{ display: \"grid\", placeItems: \"center\", flexGrow: 1, textAlign: \"center\" }}><Stack gap=\"sm\" align=\"center\">\n <Text emphasis=\"strong\">{props.title}</Text>{props.description ? <Text tone=\"muted\">{props.description}</Text> : null}\n {options.map(option => <Button key={option.id} tone=\"secondary\" loading={action.active === option.id} disabled={props.disabled === true || (action.pending && action.active !== option.id)}\n onClick={() => { if (!props.disabled) void action.run(option.id, () => props.onApply(option.id)); }}>{props.optionLabel(option)}</Button>)}\n {action.failed ? <ErrorMessage>{props.errorLabel}</ErrorMessage> : null}\n </Stack></div>;\n}\n\nexport type TableColumnSettingsProps = Readonly<{\n label: string; columns: readonly ColumnSetting[]; disabled?: boolean;\n earlierLabel: (column: ColumnSetting) => string; laterLabel: (column: ColumnSetting) => string;\n onColumnsChange: (columns: readonly ColumnSetting[]) => void;\n}>;\nexport function TableColumnSettings(props: TableColumnSettingsProps) {\n assertDistinctIds(props.columns);\n const change = (id: string, kind: \"toggle\" | \"earlier\" | \"later\") => {\n if (props.disabled) return;\n const next = changeColumnSettings(props.columns, id, kind); if (next !== props.columns) props.onColumnsChange(next);\n };\n const labelId = useId(), disabled = props.disabled === true;\n // One row per column: visibility checkbox, then reorder as icon tools (labels stay the accessible names).\n // The group label is HJM Text like Native; a browser-default <legend> rendered differently (2026-10-17 review).\n return <Stack gap=\"sm\" role=\"group\" aria-labelledby={labelId}><Text id={labelId} emphasis=\"strong\">{props.label}</Text>\n {props.columns.map(column => <Stack key={column.id} axis=\"inline\" gap=\"xs\" align=\"center\">\n <Checkbox label={column.label} checked={column.visible} layoutStyle={{ flex: 1, minInlineSize: 0 }} disabled={disabled || column.locked === true || (column.visible && props.columns.filter(item => item.visible).length === 1)} onCheckedChange={() => change(column.id, \"toggle\")} />\n <IconButton label={props.earlierLabel(column)} tone=\"ghost\" disabled={disabled || changeColumnSettings(props.columns, column.id, \"earlier\") === props.columns} onClick={() => change(column.id, \"earlier\")}><Icon name=\"chevronUp\" /></IconButton>\n <IconButton label={props.laterLabel(column)} tone=\"ghost\" disabled={disabled || changeColumnSettings(props.columns, column.id, \"later\") === props.columns} onClick={() => change(column.id, \"later\")}><Icon name=\"chevronDown\" /></IconButton>\n </Stack>)}\n </Stack>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-rail.d.ts","sourceRoot":"","sources":["../src/collection-rail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAG4B,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EACrF,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"collection-rail.d.ts","sourceRoot":"","sources":["../src/collection-rail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAG4B,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EACrF,MAAM,yCAAyC,CAAC;AAIjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACpG,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC;IAC5F,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAAC,UAAU,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,SAAS,CAAC;IACzG,MAAM,EAAE,oBAAoB,CAAC;IAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IACxF,6FAA6F;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEH,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAA+C,EAChH,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,+BA0H9F"}
|
package/dist/collection-rail.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { collectionRailRecipe, validateCollectionRail, resolveCollectionRailLayout, resolveCollectionRailViewport, getCollectionRailTargetOffset, getCollectionRailItemOffset, getCollectionRailRevealOffset, getCollectionRailKeyboardIntent, } from "@hjmds/design-contracts/collection-rail";
|
|
4
|
-
import {
|
|
4
|
+
import { IconButton } from "./actions.js";
|
|
5
|
+
import { Icon } from "./supplemental-display.js";
|
|
5
6
|
import { useOptionalHjmTheme } from "./provider.js";
|
|
6
7
|
/** Finite all-mounted list placement; Card, inputs and Dialog keep their own state. */
|
|
7
8
|
export function CollectionRail({ label, items, renderItem, labels, density = collectionRailRecipe.defaults.density, emptyContent, defaultStartKey, onStartKeyChange, layoutStyle, ...props }) {
|
|
@@ -122,6 +123,6 @@ export function CollectionRail({ label, items, renderItem, labels, density = col
|
|
|
122
123
|
if (active instanceof HTMLElement && node.contains(active))
|
|
123
124
|
detachedFocus.current = active;
|
|
124
125
|
};
|
|
125
|
-
}, style: { flex: "0 0 auto", width: position.layout.itemWidth || "auto", minWidth: 0 }, onFocusCapture: () => scrollToOffset(getCollectionRailRevealOffset(current.current.layout, current.current.offset, index), false), children: renderItem(item) }, item.id)) }), items.length === 0 ? emptyContent : null] }), _jsxs("div", { "data-collection-rail-controls": true, role: "group", "aria-label": labels.navigation, style: { display: "flex", flexWrap: "wrap", justifyContent: "flex-end", gap: "var(--hjm-space-sm)", marginBlockStart: "var(--hjm-space-sm)" }, children: [_jsx(
|
|
126
|
+
}, style: { flex: "0 0 auto", width: position.layout.itemWidth || "auto", minWidth: 0 }, onFocusCapture: () => scrollToOffset(getCollectionRailRevealOffset(current.current.layout, current.current.offset, index), false), children: renderItem(item) }, item.id)) }), items.length === 0 ? emptyContent : null] }), _jsxs("div", { "data-collection-rail-controls": true, role: "group", "aria-label": labels.navigation, style: { display: "flex", flexWrap: "wrap", justifyContent: "flex-end", gap: "var(--hjm-space-sm)", marginBlockStart: "var(--hjm-space-sm)" }, children: [_jsx(IconButton, { label: labels.previous, tone: "ghost", "aria-disabled": resolved.atStart, onClick: () => navigate("previous"), children: _jsx(Icon, { name: "chevronStart" }) }), _jsx(IconButton, { label: labels.next, tone: "ghost", "aria-disabled": resolved.atEnd, onClick: () => navigate("next"), children: _jsx(Icon, { name: "chevronEnd" }) })] })] });
|
|
126
127
|
}
|
|
127
128
|
//# sourceMappingURL=collection-rail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-rail.js","sourceRoot":"","sources":["../src/collection-rail.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAuC,MAAM,OAAO,CAAC;AAC/F,OAAO,EACL,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,6BAA6B,EACxG,6BAA6B,EAAE,2BAA2B,EAAE,6BAA6B,EACzF,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAcpD,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAA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E,gBAAgB,EAAE,qBAAqB,EAAE,aAC7I,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,mBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAG,MAAM,CAAC,QAAQ,GAAU,EACrH,KAAC,MAAM,IAAC,IAAI,EAAC,OAAO,mBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAG,MAAM,CAAC,IAAI,GAAU,IACvG,IACF,CAAC;AACT,CAAC","sourcesContent":["import { useLayoutEffect, useRef, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n collectionRailRecipe, validateCollectionRail, resolveCollectionRailLayout, resolveCollectionRailViewport,\n getCollectionRailTargetOffset, getCollectionRailItemOffset, getCollectionRailRevealOffset,\n getCollectionRailKeyboardIntent, type CollectionRailItem, type CollectionRailDensity, type CollectionRailLayout,\n} from \"@hjmds/design-contracts/collection-rail\";\nimport { Button } from \"./actions.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CollectionRailLabels = Readonly<{ previous: string; next: string; navigation: string }>;\nexport type CollectionRailProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\"> & Readonly<{\n label: string; items: readonly CollectionRailItem[]; renderItem: (item: CollectionRailItem) => ReactNode;\n labels: CollectionRailLabels; density?: CollectionRailDensity; emptyContent?: ReactNode;\n /** Initial scroll anchor, not selection. Later collection changes reconcile by stable ID. */\n defaultStartKey?: string;\n /** Observed leading item, independent of product selection/detail state. Empty lists report null. */\n onStartKeyChange?: (key: string | null) => void;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Finite all-mounted list placement; Card, inputs and Dialog keep their own state. */\nexport function CollectionRail({ label, items, renderItem, labels, density = collectionRailRecipe.defaults.density,\n emptyContent, defaultStartKey, onStartKeyChange, layoutStyle, ...props }: CollectionRailProps) {\n validateCollectionRail(items);\n if (!label.trim() || Object.values(labels).some(value => !value.trim())) throw new TypeError(\"CollectionRail labels must not be empty\");\n const theme = useOptionalHjmTheme(), direction = theme?.environment.direction ?? \"ltr\";\n const gap = collectionRailRecipe.gap;\n const viewportRef = useRef<HTMLDivElement>(null);\n const detachedFocus = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n const old = detachedFocus.current;\n detachedFocus.current = null;\n // A removed card must leave a keyboard origin in this collection, without\n // moving focus away from a surviving input or an external control.\n if (old && !old.isConnected && old.ownerDocument.activeElement === old.ownerDocument.body) {\n viewportRef.current?.focus({ preventScroll: true });\n }\n });\n const anchor = useRef<string | null>(defaultStartKey ?? items[0]?.id ?? null);\n const initialized = useRef(false);\n if (!initialized.current) { validateCollectionRail(items, defaultStartKey); initialized.current = true; }\n const callback = useRef(onStartKeyChange); callback.current = onStartKeyChange;\n const current = useRef({ layout: resolveCollectionRailLayout(items.length, 0, density, gap), offset: 0 });\n const pendingOffset = useRef<number | null>(null);\n const [position, setPosition] = useState(current.current);\n const identity = JSON.stringify(items.map(item => item.id));\n const itemsRef = useRef(items); itemsRef.current = items;\n\n function publish(layout: CollectionRailLayout, offset: number) {\n const resolved = resolveCollectionRailViewport(layout, offset);\n const key = itemsRef.current[resolved.startIndex]?.id ?? null;\n if (key !== anchor.current) { anchor.current = key; callback.current?.(key); }\n current.current = { layout, offset: resolved.offset };\n setPosition(current.current);\n }\n function scrollToOffset(offset: number, animated: boolean) {\n const viewport = viewportRef.current;\n if (!viewport) return;\n const resolved = resolveCollectionRailViewport(current.current.layout, offset);\n // CSS RTL scrollLeft is negative; clamp Safari rubber-banding through the\n // shared logical resolver rather than reversing data or selection keys.\n viewport.scrollTo({ left: direction === \"rtl\" ? -resolved.offset : resolved.offset,\n behavior: animated && !theme?.environment.reducedMotion ? \"smooth\" : \"instant\" });\n pendingOffset.current = animated && !theme?.environment.reducedMotion ? resolved.offset : null;\n // Smooth scroll is a request, not an observed viewport. Publishing its\n // destination now would disable the end action and report an unseen anchor.\n publish(current.current.layout, direction === \"rtl\" ? -viewport.scrollLeft : viewport.scrollLeft);\n }\n useLayoutEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) return;\n let initialMeasurement = true;\n function measure() {\n const next = resolveCollectionRailLayout(itemsRef.current.length, viewport!.clientWidth, density, gap);\n // ResizeObserver also delivers an initial unchanged box. Re-aligning then\n // would undo a focus reveal that happened after the layout effect.\n if (!initialMeasurement && next.viewport === current.current.layout.viewport) return;\n initialMeasurement = false;\n pendingOffset.current = null;\n const index = Math.max(0, itemsRef.current.findIndex(item => item.id === anchor.current));\n let offset = next.count ? getCollectionRailItemOffset(next, index) : 0;\n const focused = document.activeElement?.closest(\"[data-collection-rail-item]\");\n const focusedIndex = focused && viewport!.contains(focused)\n ? itemsRef.current.findIndex(item => item.id === focused.getAttribute(\"data-collection-rail-item\")) : -1;\n // A narrower viewport cannot keep a distant focused action and the old\n // leading item visible together; focus exposure takes priority over anchor alignment.\n if (focusedIndex >= 0) offset = getCollectionRailRevealOffset(next, offset, focusedIndex);\n current.current = { layout: next, offset };\n // Width/direction changes keep the leading item's identity, and never\n // key/remount its input or detail owner (docs/collection-rail.md).\n viewport!.scrollTo({ left: direction === \"rtl\" ? -offset : offset, behavior: \"instant\" });\n publish(next, offset);\n }\n measure();\n const observer = new ResizeObserver(measure); observer.observe(viewport);\n return () => observer.disconnect();\n }, [identity, density, gap, direction]);\n\n function navigate(intent: \"previous\" | \"next\" | \"first\" | \"last\") {\n scrollToOffset(getCollectionRailTargetOffset(current.current.layout, pendingOffset.current ?? current.current.offset, intent), true);\n }\n const resolved = resolveCollectionRailViewport(position.layout, position.offset);\n return <div {...props} style={{ ...props.style, ...layoutStyle, minWidth: 0 }}\n data-collection-rail data-start-key={items[resolved.startIndex]?.id} dir={direction}\n onKeyDown={event => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n // Item widgets own arrows/Home/End. Rail navigation belongs only to its\n // viewport and explicit controls, not an input nested in a visible card.\n if (event.target !== viewportRef.current && !(event.target instanceof Element && event.target.closest(\"[data-collection-rail-controls]\"))) return;\n const intent = getCollectionRailKeyboardIntent(event.key, direction);\n if (intent) { event.preventDefault(); navigate(intent); }\n }}>\n <div ref={viewportRef} role=\"list\" aria-label={label} tabIndex={0} data-collection-rail-viewport\n style={{ overflowX: \"auto\", overscrollBehaviorX: \"contain\", minWidth: 0 }}\n onPointerDown={() => { pendingOffset.current = null; }} onWheel={() => { pendingOffset.current = null; }}\n onScroll={event => {\n const offset = direction === \"rtl\" ? -event.currentTarget.scrollLeft : event.currentTarget.scrollLeft;\n if (pendingOffset.current !== null && Math.abs(offset - pendingOffset.current) <= 0.5) pendingOffset.current = null;\n publish(current.current.layout, offset);\n }}>\n <div style={{ display: \"flex\", gap, width: \"max-content\", minWidth: \"100%\", paddingBlock: \"var(--hjm-space-xs)\" }}>\n {items.map((item, index) => <div key={item.id} role=\"listitem\" data-collection-rail-item={item.id}\n ref={node => {\n if (!node) return;\n return () => {\n const active = node.ownerDocument.activeElement;\n if (active instanceof HTMLElement && node.contains(active)) detachedFocus.current = active;\n };\n }}\n style={{ flex: \"0 0 auto\", width: position.layout.itemWidth || \"auto\", minWidth: 0 }}\n onFocusCapture={() => scrollToOffset(getCollectionRailRevealOffset(current.current.layout, current.current.offset, index), false)}>\n {renderItem(item)}\n </div>)}\n </div>\n {items.length === 0 ? emptyContent : null}\n </div>\n <div data-collection-rail-controls role=\"group\" aria-label={labels.navigation}\n style={{ display: \"flex\", flexWrap: \"wrap\", justifyContent: \"flex-end\", gap: \"var(--hjm-space-sm)\", marginBlockStart: \"var(--hjm-space-sm)\" }}>\n <Button tone=\"ghost\" aria-disabled={resolved.atStart} onClick={() => navigate(\"previous\")}>{labels.previous}</Button>\n <Button tone=\"ghost\" aria-disabled={resolved.atEnd} onClick={() => navigate(\"next\")}>{labels.next}</Button>\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EAAE,CAAC,EAAE,EACpF,cAAc,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,6BAA6B,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,YAChI,UAAU,CAAC,IAAI,CAAC,IAVmB,IAAI,CAAC,EAAE,CAWvC,CAAC,GACH,EACL,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,IACrC,EACN,sDAAmC,IAAI,EAAC,OAAO,gBAAa,MAAM,CAAC,UAAU,EAC3E,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAE7I,KAAC,UAAU,IAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAC,OAAO,mBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAE,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,GAAG,GAAa,EAChK,KAAC,UAAU,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAC,OAAO,mBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAE,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,GAAa,IAChJ,IACF,CAAC;AACT,CAAC","sourcesContent":["import { useLayoutEffect, useRef, useState, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n collectionRailRecipe, validateCollectionRail, resolveCollectionRailLayout, resolveCollectionRailViewport,\n getCollectionRailTargetOffset, getCollectionRailItemOffset, getCollectionRailRevealOffset,\n getCollectionRailKeyboardIntent, type CollectionRailItem, type CollectionRailDensity, type CollectionRailLayout,\n} from \"@hjmds/design-contracts/collection-rail\";\nimport { IconButton } from \"./actions.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CollectionRailLabels = Readonly<{ previous: string; next: string; navigation: string }>;\nexport type CollectionRailProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\"> & Readonly<{\n label: string; items: readonly CollectionRailItem[]; renderItem: (item: CollectionRailItem) => ReactNode;\n labels: CollectionRailLabels; density?: CollectionRailDensity; emptyContent?: ReactNode;\n /** Initial scroll anchor, not selection. Later collection changes reconcile by stable ID. */\n defaultStartKey?: string;\n /** Observed leading item, independent of product selection/detail state. Empty lists report null. */\n onStartKeyChange?: (key: string | null) => void;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Finite all-mounted list placement; Card, inputs and Dialog keep their own state. */\nexport function CollectionRail({ label, items, renderItem, labels, density = collectionRailRecipe.defaults.density,\n emptyContent, defaultStartKey, onStartKeyChange, layoutStyle, ...props }: CollectionRailProps) {\n validateCollectionRail(items);\n if (!label.trim() || Object.values(labels).some(value => !value.trim())) throw new TypeError(\"CollectionRail labels must not be empty\");\n const theme = useOptionalHjmTheme(), direction = theme?.environment.direction ?? \"ltr\";\n const gap = collectionRailRecipe.gap;\n const viewportRef = useRef<HTMLDivElement>(null);\n const detachedFocus = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n const old = detachedFocus.current;\n detachedFocus.current = null;\n // A removed card must leave a keyboard origin in this collection, without\n // moving focus away from a surviving input or an external control.\n if (old && !old.isConnected && old.ownerDocument.activeElement === old.ownerDocument.body) {\n viewportRef.current?.focus({ preventScroll: true });\n }\n });\n const anchor = useRef<string | null>(defaultStartKey ?? items[0]?.id ?? null);\n const initialized = useRef(false);\n if (!initialized.current) { validateCollectionRail(items, defaultStartKey); initialized.current = true; }\n const callback = useRef(onStartKeyChange); callback.current = onStartKeyChange;\n const current = useRef({ layout: resolveCollectionRailLayout(items.length, 0, density, gap), offset: 0 });\n const pendingOffset = useRef<number | null>(null);\n const [position, setPosition] = useState(current.current);\n const identity = JSON.stringify(items.map(item => item.id));\n const itemsRef = useRef(items); itemsRef.current = items;\n\n function publish(layout: CollectionRailLayout, offset: number) {\n const resolved = resolveCollectionRailViewport(layout, offset);\n const key = itemsRef.current[resolved.startIndex]?.id ?? null;\n if (key !== anchor.current) { anchor.current = key; callback.current?.(key); }\n current.current = { layout, offset: resolved.offset };\n setPosition(current.current);\n }\n function scrollToOffset(offset: number, animated: boolean) {\n const viewport = viewportRef.current;\n if (!viewport) return;\n const resolved = resolveCollectionRailViewport(current.current.layout, offset);\n // CSS RTL scrollLeft is negative; clamp Safari rubber-banding through the\n // shared logical resolver rather than reversing data or selection keys.\n viewport.scrollTo({ left: direction === \"rtl\" ? -resolved.offset : resolved.offset,\n behavior: animated && !theme?.environment.reducedMotion ? \"smooth\" : \"instant\" });\n pendingOffset.current = animated && !theme?.environment.reducedMotion ? resolved.offset : null;\n // Smooth scroll is a request, not an observed viewport. Publishing its\n // destination now would disable the end action and report an unseen anchor.\n publish(current.current.layout, direction === \"rtl\" ? -viewport.scrollLeft : viewport.scrollLeft);\n }\n useLayoutEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) return;\n let initialMeasurement = true;\n function measure() {\n const next = resolveCollectionRailLayout(itemsRef.current.length, viewport!.clientWidth, density, gap);\n // ResizeObserver also delivers an initial unchanged box. Re-aligning then\n // would undo a focus reveal that happened after the layout effect.\n if (!initialMeasurement && next.viewport === current.current.layout.viewport) return;\n initialMeasurement = false;\n pendingOffset.current = null;\n const index = Math.max(0, itemsRef.current.findIndex(item => item.id === anchor.current));\n let offset = next.count ? getCollectionRailItemOffset(next, index) : 0;\n const focused = document.activeElement?.closest(\"[data-collection-rail-item]\");\n const focusedIndex = focused && viewport!.contains(focused)\n ? itemsRef.current.findIndex(item => item.id === focused.getAttribute(\"data-collection-rail-item\")) : -1;\n // A narrower viewport cannot keep a distant focused action and the old\n // leading item visible together; focus exposure takes priority over anchor alignment.\n if (focusedIndex >= 0) offset = getCollectionRailRevealOffset(next, offset, focusedIndex);\n current.current = { layout: next, offset };\n // Width/direction changes keep the leading item's identity, and never\n // key/remount its input or detail owner (docs/collection-rail.md).\n viewport!.scrollTo({ left: direction === \"rtl\" ? -offset : offset, behavior: \"instant\" });\n publish(next, offset);\n }\n measure();\n const observer = new ResizeObserver(measure); observer.observe(viewport);\n return () => observer.disconnect();\n }, [identity, density, gap, direction]);\n\n function navigate(intent: \"previous\" | \"next\" | \"first\" | \"last\") {\n scrollToOffset(getCollectionRailTargetOffset(current.current.layout, pendingOffset.current ?? current.current.offset, intent), true);\n }\n const resolved = resolveCollectionRailViewport(position.layout, position.offset);\n return <div {...props} style={{ ...props.style, ...layoutStyle, minWidth: 0 }}\n data-collection-rail data-start-key={items[resolved.startIndex]?.id} dir={direction}\n onKeyDown={event => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n // Item widgets own arrows/Home/End. Rail navigation belongs only to its\n // viewport and explicit controls, not an input nested in a visible card.\n if (event.target !== viewportRef.current && !(event.target instanceof Element && event.target.closest(\"[data-collection-rail-controls]\"))) return;\n const intent = getCollectionRailKeyboardIntent(event.key, direction);\n if (intent) { event.preventDefault(); navigate(intent); }\n }}>\n <div ref={viewportRef} role=\"list\" aria-label={label} tabIndex={0} data-collection-rail-viewport\n style={{ overflowX: \"auto\", overscrollBehaviorX: \"contain\", minWidth: 0 }}\n onPointerDown={() => { pendingOffset.current = null; }} onWheel={() => { pendingOffset.current = null; }}\n onScroll={event => {\n const offset = direction === \"rtl\" ? -event.currentTarget.scrollLeft : event.currentTarget.scrollLeft;\n if (pendingOffset.current !== null && Math.abs(offset - pendingOffset.current) <= 0.5) pendingOffset.current = null;\n publish(current.current.layout, offset);\n }}>\n <div style={{ display: \"flex\", gap, width: \"max-content\", minWidth: \"100%\", paddingBlock: \"var(--hjm-space-xs)\" }}>\n {items.map((item, index) => <div key={item.id} role=\"listitem\" data-collection-rail-item={item.id}\n ref={node => {\n if (!node) return;\n return () => {\n const active = node.ownerDocument.activeElement;\n if (active instanceof HTMLElement && node.contains(active)) detachedFocus.current = active;\n };\n }}\n style={{ flex: \"0 0 auto\", width: position.layout.itemWidth || \"auto\", minWidth: 0 }}\n onFocusCapture={() => scrollToOffset(getCollectionRailRevealOffset(current.current.layout, current.current.offset, index), false)}>\n {renderItem(item)}\n </div>)}\n </div>\n {items.length === 0 ? emptyContent : null}\n </div>\n <div data-collection-rail-controls role=\"group\" aria-label={labels.navigation}\n style={{ display: \"flex\", flexWrap: \"wrap\", justifyContent: \"flex-end\", gap: \"var(--hjm-space-sm)\", marginBlockStart: \"var(--hjm-space-sm)\" }}>\n {/* Tool actions: icon buttons named by the localized label, as Carousel (2026-10-17 review E9). */}\n <IconButton label={labels.previous} tone=\"ghost\" aria-disabled={resolved.atStart} onClick={() => navigate(\"previous\")}><Icon name=\"chevronStart\" /></IconButton>\n <IconButton label={labels.next} tone=\"ghost\" aria-disabled={resolved.atEnd} onClick={() => navigate(\"next\")}><Icon name=\"chevronEnd\" /></IconButton>\n </div>\n </div>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../src/communication.tsx"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAsB,KAAK,WAAW,EAAC,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACjH,OAAO,EAA8B,KAAK,gBAAgB,EAAC,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../src/communication.tsx"],"names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KAAK,EAAC,qBAAqB,CAAC,CAAC,CAAC,+BA6BjE"}
|
package/dist/communication.js
CHANGED
|
@@ -5,7 +5,8 @@ import { resolveSearchCommit } from "@hjmds/design-contracts/screen-patterns";
|
|
|
5
5
|
import { validateReplyTarget } from "@hjmds/design-contracts/communication";
|
|
6
6
|
import { ChatMessage, MessageComposer } from "./screens.js";
|
|
7
7
|
import { SearchScreen } from "./screen-flows.js";
|
|
8
|
-
import {
|
|
8
|
+
import { IconButton } from "./actions.js";
|
|
9
|
+
import { Icon } from "./supplemental-display.js";
|
|
9
10
|
import { Stack, Text } from "./layout.js";
|
|
10
11
|
import { useCompositionAction } from "./internal/use-composition-action.js";
|
|
11
12
|
export function ReplyMessage({ messageId, onReply, replyLabel, replyDisabled = false, swipeAction = "reply", ...message }) {
|
|
@@ -66,6 +67,8 @@ export function ExpandableSearch(props) {
|
|
|
66
67
|
const commit = (query) => { const normalized = resolveSearchCommit(query); if (normalized === null)
|
|
67
68
|
return; setCommitted(normalized); props.onSubmit?.(normalized); };
|
|
68
69
|
const current = snapshot?.query === props.query ? snapshot.response : null;
|
|
69
|
-
|
|
70
|
+
// Opening and closing are tool actions: a search icon at the area's end, and the search screen's own header-leading
|
|
71
|
+
// close exit. A full-width primary "펼치기" button and a text "닫기" button read as product actions (2026-10-17 review).
|
|
72
|
+
return _jsx(Stack, { ref: host, gap: "sm", children: !props.expanded ? _jsx(IconButton, { ref: opener, label: props.labels.open, tone: "ghost", disabled: props.disabled === true, layoutStyle: { alignSelf: "flex-end" }, onClick: () => props.onExpandedChange(true), children: _jsx(Icon, { name: "search" }) }) : _jsxs(_Fragment, { children: [_jsx(SearchScreen, { title: props.labels.title, titleVisibility: "hidden", exit: { kind: "close", label: props.labels.cancel, onClick: cancel }, queryLabel: props.labels.query, queryClearLabel: props.labels.clear, query: props.query, onQueryChange: props.onQueryChange, onSearch: search, ...(props.debounceMs === undefined ? {} : { debounceMs: props.debounceMs }), ...(props.recentQueries ? { recentQueries: props.recentQueries } : {}), committedQuery: committed, onSubmit: commit, searching: pending, searchingLabel: props.labels.searching, suggestions: { items: current?.suggestions ?? [], commitLabel: props.labels.commit, countLabel: props.labels.suggestionCount }, children: current ? props.renderResult(current.result) : null }), failed ? _jsx(Text, { role: "alert", tone: "danger", style: { textAlign: "center" }, children: props.labels.error }) : null] }) });
|
|
70
73
|
}
|
|
71
74
|
//# sourceMappingURL=communication.js.map
|