@funstack/ui 0.1.0-alpha.19 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion-item.mjs +2 -2
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.d.mts.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +3 -20
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/alert-dialog/alert-dialog-action.d.mts +73 -0
- package/dist/alert-dialog/alert-dialog-action.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-action.mjs +23 -0
- package/dist/alert-dialog/alert-dialog-action.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-cancel.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs +50 -0
- package/dist/alert-dialog/alert-dialog-cancel.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-context.mjs +24 -0
- package/dist/alert-dialog/alert-dialog-context.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts +25 -0
- package/dist/alert-dialog/alert-dialog-description.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-description.mjs +20 -0
- package/dist/alert-dialog/alert-dialog-description.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts +27 -0
- package/dist/alert-dialog/alert-dialog-form.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-form.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-form.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts +42 -0
- package/dist/alert-dialog/alert-dialog-popup.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs +53 -0
- package/dist/alert-dialog/alert-dialog-popup.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts +31 -0
- package/dist/alert-dialog/alert-dialog-root.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-root.mjs +22 -0
- package/dist/alert-dialog/alert-dialog-root.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-title.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-title.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-title.mjs.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts +23 -0
- package/dist/alert-dialog/alert-dialog-trigger.d.mts.map +1 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs +18 -0
- package/dist/alert-dialog/alert-dialog-trigger.mjs.map +1 -0
- package/dist/alert-dialog/index.d.mts +33 -0
- package/dist/alert-dialog/index.d.mts.map +1 -0
- package/dist/alert-dialog/index.mjs +33 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- package/dist/checkbox-group/checkbox-group-parent.mjs +1 -1
- package/dist/collapsible/collapsible-context.mjs +8 -0
- package/dist/collapsible/collapsible-context.mjs.map +1 -0
- package/dist/collapsible/collapsible-panel.d.mts +53 -0
- package/dist/collapsible/collapsible-panel.d.mts.map +1 -0
- package/dist/collapsible/collapsible-panel.mjs +41 -0
- package/dist/collapsible/collapsible-panel.mjs.map +1 -0
- package/dist/collapsible/collapsible-root.d.mts +108 -0
- package/dist/collapsible/collapsible-root.d.mts.map +1 -0
- package/dist/collapsible/collapsible-root.mjs +147 -0
- package/dist/collapsible/collapsible-root.mjs.map +1 -0
- package/dist/collapsible/collapsible-trigger.d.mts +45 -0
- package/dist/collapsible/collapsible-trigger.d.mts.map +1 -0
- package/dist/collapsible/collapsible-trigger.mjs +62 -0
- package/dist/collapsible/collapsible-trigger.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +21 -0
- package/dist/collapsible/index.d.mts.map +1 -0
- package/dist/collapsible/index.mjs +21 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/chip-text.mjs +24 -0
- package/dist/combobox/chip-text.mjs.map +1 -0
- package/dist/combobox/combobox-chips.d.mts +159 -0
- package/dist/combobox/combobox-chips.d.mts.map +1 -0
- package/dist/combobox/combobox-chips.mjs +198 -0
- package/dist/combobox/combobox-chips.mjs.map +1 -0
- package/dist/combobox/combobox-clear.d.mts +5 -2
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +3 -1
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-context.mjs +4 -5
- package/dist/combobox/combobox-context.mjs.map +1 -1
- package/dist/combobox/combobox-input.d.mts +10 -3
- package/dist/combobox/combobox-input.d.mts.map +1 -1
- package/dist/combobox/combobox-input.mjs +13 -5
- package/dist/combobox/combobox-input.mjs.map +1 -1
- package/dist/combobox/combobox-keyboard.mjs +50 -4
- package/dist/combobox/combobox-keyboard.mjs.map +1 -1
- package/dist/combobox/combobox-list.d.mts +1 -1
- package/dist/combobox/combobox-list.mjs +2 -1
- package/dist/combobox/combobox-list.mjs.map +1 -1
- package/dist/combobox/combobox-option.d.mts +5 -2
- package/dist/combobox/combobox-option.d.mts.map +1 -1
- package/dist/combobox/combobox-option.mjs +4 -3
- package/dist/combobox/combobox-option.mjs.map +1 -1
- package/dist/combobox/combobox-root.d.mts +127 -35
- package/dist/combobox/combobox-root.d.mts.map +1 -1
- package/dist/combobox/combobox-root.mjs +396 -44
- package/dist/combobox/combobox-root.mjs.map +1 -1
- package/dist/combobox/index.d.mts +8 -2
- package/dist/combobox/index.d.mts.map +1 -1
- package/dist/combobox/index.mjs +7 -1
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/combobox/use-combobox-form.mjs +2 -3
- package/dist/combobox/use-combobox-form.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +9 -5
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +19 -8
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.d.mts +2 -0
- package/dist/dialog/dialog-context.mjs +14 -2
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-description.d.mts +2 -1
- package/dist/dialog/dialog-description.d.mts.map +1 -1
- package/dist/dialog/dialog-description.mjs +8 -4
- package/dist/dialog/dialog-description.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +2 -1
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +11 -6
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +2 -1
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +23 -14
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +2 -1
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +15 -5
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-title.d.mts +2 -1
- package/dist/dialog/dialog-title.d.mts.map +1 -1
- package/dist/dialog/dialog-title.mjs +8 -4
- package/dist/dialog/dialog-title.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +2 -1
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +14 -9
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/docs/components/accordion.md +2 -0
- package/dist/docs/components/alert-dialog.md +546 -0
- package/dist/docs/components/collapsible.md +408 -0
- package/dist/docs/components/combobox.md +288 -26
- package/dist/docs/components/dialog.md +7 -5
- package/dist/docs/components/field.md +180 -3
- package/dist/docs/components/hover-card.md +494 -0
- package/dist/docs/components/multi-select.md +622 -0
- package/dist/docs/components/number-field.md +1 -1
- package/dist/docs/components/popover.md +4 -4
- package/dist/docs/components/select.md +9 -1
- package/dist/docs/components/separator.md +182 -0
- package/dist/docs/components/slider.md +1 -1
- package/dist/docs/components/tooltip.md +1 -1
- package/dist/docs/concepts/experimental.md +3 -3
- package/dist/docs/concepts/server-components.md +1 -1
- package/dist/docs/index.md +7 -2
- package/dist/docs/roadmap.md +8 -0
- package/dist/field/field-control.d.mts +13 -4
- package/dist/field/field-control.d.mts.map +1 -1
- package/dist/field/field-control.mjs +39 -10
- package/dist/field/field-control.mjs.map +1 -1
- package/dist/field/field-label.d.mts +6 -2
- package/dist/field/field-label.d.mts.map +1 -1
- package/dist/field/field-label.mjs +12 -2
- package/dist/field/field-label.mjs.map +1 -1
- package/dist/field/field-root.mjs +9 -1
- package/dist/field/field-root.mjs.map +1 -1
- package/dist/hover-card/hover-card-context.mjs +13 -0
- package/dist/hover-card/hover-card-context.mjs.map +1 -0
- package/dist/hover-card/hover-card-popup.d.mts +102 -0
- package/dist/hover-card/hover-card-popup.d.mts.map +1 -0
- package/dist/hover-card/hover-card-popup.mjs +80 -0
- package/dist/hover-card/hover-card-popup.mjs.map +1 -0
- package/dist/hover-card/hover-card-root.d.mts +94 -0
- package/dist/hover-card/hover-card-root.d.mts.map +1 -0
- package/dist/hover-card/hover-card-root.mjs +74 -0
- package/dist/hover-card/hover-card-root.mjs.map +1 -0
- package/dist/hover-card/hover-card-trigger.d.mts +65 -0
- package/dist/hover-card/hover-card-trigger.d.mts.map +1 -0
- package/dist/hover-card/hover-card-trigger.mjs +109 -0
- package/dist/hover-card/hover-card-trigger.mjs.map +1 -0
- package/dist/hover-card/index.d.mts +24 -0
- package/dist/hover-card/index.d.mts.map +1 -0
- package/dist/hover-card/index.mjs +24 -0
- package/dist/hover-card/index.mjs.map +1 -0
- package/dist/hover-card/use-hover-card-interest.mjs +242 -0
- package/dist/hover-card/use-hover-card-interest.mjs.map +1 -0
- package/dist/index.d.mts +38 -9
- package/dist/index.mjs +6 -1
- package/dist/internal/action/use-multiple-selection.mjs +83 -0
- package/dist/internal/action/use-multiple-selection.mjs.map +1 -0
- package/dist/internal/details-summary.mjs +56 -0
- package/dist/internal/details-summary.mjs.map +1 -0
- package/dist/internal/form/field-context.mjs.map +1 -1
- package/dist/internal/form/hidden-values.mjs +29 -0
- package/dist/internal/form/hidden-values.mjs.map +1 -0
- package/dist/internal/form/validity.mjs +3 -1
- package/dist/internal/form/validity.mjs.map +1 -1
- package/dist/internal/overlay/use-interest-dismiss.mjs +2 -1
- package/dist/internal/overlay/use-interest-dismiss.mjs.map +1 -1
- package/dist/internal/overlay/use-overlay-close.mjs +5 -3
- package/dist/internal/overlay/use-overlay-close.mjs.map +1 -1
- package/dist/internal/overlay/use-overlay-root.mjs +4 -1
- package/dist/internal/overlay/use-overlay-root.mjs.map +1 -1
- package/dist/internal/overlay/use-popover-popup.mjs +20 -7
- package/dist/internal/overlay/use-popover-popup.mjs.map +1 -1
- package/dist/internal/overlay/use-popover-trigger.d.mts +1 -1
- package/dist/internal/typeahead.mjs +52 -0
- package/dist/internal/typeahead.mjs.map +1 -0
- package/dist/{combobox → internal}/use-active-option.mjs +8 -6
- package/dist/internal/use-active-option.mjs.map +1 -0
- package/dist/{combobox → internal}/use-deferred-leave.mjs +20 -12
- package/dist/internal/use-deferred-leave.mjs.map +1 -0
- package/dist/internal/use-name-warning.mjs +57 -1
- package/dist/internal/use-name-warning.mjs.map +1 -1
- package/dist/internal/use-option-registry.mjs +70 -0
- package/dist/internal/use-option-registry.mjs.map +1 -0
- package/dist/menu/use-menu-keyboard.mjs +7 -27
- package/dist/menu/use-menu-keyboard.mjs.map +1 -1
- package/dist/multi-select/index.d.mts +37 -0
- package/dist/multi-select/index.d.mts.map +1 -0
- package/dist/multi-select/index.mjs +37 -0
- package/dist/multi-select/index.mjs.map +1 -0
- package/dist/multi-select/multi-select-context.mjs +19 -0
- package/dist/multi-select/multi-select-context.mjs.map +1 -0
- package/dist/multi-select/multi-select-group.d.mts +120 -0
- package/dist/multi-select/multi-select-group.d.mts.map +1 -0
- package/dist/multi-select/multi-select-group.mjs +111 -0
- package/dist/multi-select/multi-select-group.mjs.map +1 -0
- package/dist/multi-select/multi-select-keyboard.mjs +145 -0
- package/dist/multi-select/multi-select-keyboard.mjs.map +1 -0
- package/dist/multi-select/multi-select-label.d.mts +42 -0
- package/dist/multi-select/multi-select-label.d.mts.map +1 -0
- package/dist/multi-select/multi-select-label.mjs +41 -0
- package/dist/multi-select/multi-select-label.mjs.map +1 -0
- package/dist/multi-select/multi-select-list.d.mts +47 -0
- package/dist/multi-select/multi-select-list.d.mts.map +1 -0
- package/dist/multi-select/multi-select-list.mjs +65 -0
- package/dist/multi-select/multi-select-list.mjs.map +1 -0
- package/dist/multi-select/multi-select-option.d.mts +68 -0
- package/dist/multi-select/multi-select-option.d.mts.map +1 -0
- package/dist/multi-select/multi-select-option.mjs +93 -0
- package/dist/multi-select/multi-select-option.mjs.map +1 -0
- package/dist/multi-select/multi-select-popup.d.mts +58 -0
- package/dist/multi-select/multi-select-popup.d.mts.map +1 -0
- package/dist/multi-select/multi-select-popup.mjs +71 -0
- package/dist/multi-select/multi-select-popup.mjs.map +1 -0
- package/dist/multi-select/multi-select-root.d.mts +125 -0
- package/dist/multi-select/multi-select-root.d.mts.map +1 -0
- package/dist/multi-select/multi-select-root.mjs +257 -0
- package/dist/multi-select/multi-select-root.mjs.map +1 -0
- package/dist/multi-select/multi-select-trigger.d.mts +66 -0
- package/dist/multi-select/multi-select-trigger.d.mts.map +1 -0
- package/dist/multi-select/multi-select-trigger.mjs +169 -0
- package/dist/multi-select/multi-select-trigger.mjs.map +1 -0
- package/dist/multi-select/multi-select-value.d.mts +57 -0
- package/dist/multi-select/multi-select-value.d.mts.map +1 -0
- package/dist/multi-select/multi-select-value.mjs +41 -0
- package/dist/multi-select/multi-select-value.mjs.map +1 -0
- package/dist/number-field/number-field-root.mjs +1 -1
- package/dist/number-field/use-step-button.d.mts.map +1 -1
- package/dist/number-field/use-step-button.mjs +11 -2
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +6 -3
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +3 -2
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-popup.mjs +1 -1
- package/dist/select/select-root.d.mts +1 -1
- package/dist/select/select-root.d.mts.map +1 -1
- package/dist/select/select-root.mjs +5 -1
- package/dist/select/select-root.mjs.map +1 -1
- package/dist/separator/index.d.mts +3 -0
- package/dist/separator/index.mjs +1 -0
- package/dist/separator/separator.d.mts +58 -0
- package/dist/separator/separator.d.mts.map +1 -0
- package/dist/separator/separator.mjs +41 -0
- package/dist/separator/separator.mjs.map +1 -0
- package/dist/slider/slider-root.mjs +1 -0
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/toast/toast-viewport.mjs +1 -1
- package/package.json +6 -1
- package/skills/funstack-ui-knowledge/SKILL.md +14 -9
- package/dist/combobox/use-active-option.mjs.map +0 -1
- package/dist/combobox/use-deferred-leave.mjs.map +0 -1
- package/dist/combobox/use-option-registry.mjs +0 -52
- package/dist/combobox/use-option-registry.mjs.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useShownDescriptionWarning } from "../internal/use-name-warning.mjs";
|
|
3
|
+
import { useDialogContext } from "../dialog/dialog-context.mjs";
|
|
4
|
+
import { useDialogPopup } from "../dialog/dialog-popup.mjs";
|
|
5
|
+
import { AlertDialogCancelContext, firstEnabledCancel } from "./alert-dialog-context.mjs";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region src/alert-dialog/alert-dialog-popup.tsx
|
|
9
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
10
|
+
/**
|
|
11
|
+
* The alert dialog: `Dialog.Popup` rendering `<dialog role="alertdialog">`, always opened with
|
|
12
|
+
* `showModal()`, without light dismiss (a modal `<dialog>` without `closedby` closes on Escape and
|
|
13
|
+
* not on a backdrop click, in every engine and before hydration). Escape closes it: the
|
|
14
|
+
* platform's close request, reported to `onOpenChange(false, { reason: "dismiss" })`; there is no
|
|
15
|
+
* prop to turn it off. Opens with focus on the first enabled `AlertDialog.Cancel` unless
|
|
16
|
+
* `initialFocus` is given.
|
|
17
|
+
*
|
|
18
|
+
* Owned keys (conventions 1.2): Dialog.Popup's (`id`, `open`, `closedby`, `aria-labelledby` and
|
|
19
|
+
* `aria-describedby` token-merged, `data-modal`, `suppressHydrationWarning`) and `role`.
|
|
20
|
+
*
|
|
21
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
22
|
+
*/
|
|
23
|
+
function AlertDialogPopup(props) {
|
|
24
|
+
const ctx = useDialogContext("AlertDialog.Popup");
|
|
25
|
+
const [cancels] = useState(() => /* @__PURE__ */ new Set());
|
|
26
|
+
const defaultFocus = props.initialFocus === void 0;
|
|
27
|
+
const cancelContext = useMemo(() => ({
|
|
28
|
+
defaultFocus,
|
|
29
|
+
register: (element) => {
|
|
30
|
+
cancels.add(element);
|
|
31
|
+
return () => cancels.delete(element);
|
|
32
|
+
}
|
|
33
|
+
}), [defaultFocus, cancels]);
|
|
34
|
+
useShownDescriptionWarning(ctx.popupRef, isDev && "AlertDialog.Popup: the alert dialog has no description. Render an AlertDialog.Description with the message (or give the Popup an `aria-describedby`): a screen reader announces an alert dialog by its name and description.");
|
|
35
|
+
return useDialogPopup({
|
|
36
|
+
...props,
|
|
37
|
+
lightDismiss: false,
|
|
38
|
+
experimental_closedBy: false
|
|
39
|
+
}, {
|
|
40
|
+
namespace: "AlertDialog",
|
|
41
|
+
role: "alertdialog",
|
|
42
|
+
defaultInitialFocus: (dialog) => firstEnabledCancel(dialog, cancels),
|
|
43
|
+
wrapChildren: (children) => /* @__PURE__ */ jsx(AlertDialogCancelContext, {
|
|
44
|
+
value: cancelContext,
|
|
45
|
+
children
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
AlertDialogPopup.displayName = "AlertDialogPopup";
|
|
50
|
+
//#endregion
|
|
51
|
+
export { AlertDialogPopup };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=alert-dialog-popup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-popup.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-popup.tsx"],"sourcesContent":["\"use client\";\nimport { useMemo, useState } from \"react\";\nimport type { ReactNode, RefObject } from \"react\";\nimport { useDialogContext } from \"../dialog/dialog-context.js\";\nimport { useDialogPopup } from \"../dialog/dialog-popup.js\";\nimport type { DialogPopupProps, DialogPopupState } from \"../dialog/dialog-popup.js\";\nimport { useShownDescriptionWarning } from \"../internal/use-name-warning.js\";\nimport { AlertDialogCancelContext, firstEnabledCancel } from \"./alert-dialog-context.js\";\nimport type { AlertDialogCancelContextValue } from \"./alert-dialog-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** State of `AlertDialog.Popup`: Dialog's, with `modal` always `true`. */\nexport type AlertDialogPopupState = DialogPopupState;\n\n/**\n * Props of `AlertDialog.Popup`: `Dialog.Popup`'s without `role` (owned: `alertdialog`),\n * `lightDismiss` and `experimental_closedBy` (a click on the backdrop never closes an alert\n * dialog).\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport interface AlertDialogPopupProps extends Omit<\n DialogPopupProps,\n \"role\" | \"lightDismiss\" | \"experimental_closedBy\"\n> {\n /**\n * Element to focus when the dialog opens: a ref, or a selector resolved inside the dialog.\n * With it, no Cancel renders `autofocus`. Point it at the Title with `tabIndex={-1}` for a\n * long message, so that it is read from the top (APG).\n *\n * @defaultValue the first enabled `AlertDialog.Cancel`; without one, the platform's choice\n * (the first focusable element)\n */\n initialFocus?: RefObject<HTMLElement | null> | string;\n}\n\n/**\n * The alert dialog: `Dialog.Popup` rendering `<dialog role=\"alertdialog\">`, always opened with\n * `showModal()`, without light dismiss (a modal `<dialog>` without `closedby` closes on Escape and\n * not on a backdrop click, in every engine and before hydration). Escape closes it: the\n * platform's close request, reported to `onOpenChange(false, { reason: \"dismiss\" })`; there is no\n * prop to turn it off. Opens with focus on the first enabled `AlertDialog.Cancel` unless\n * `initialFocus` is given.\n *\n * Owned keys (conventions 1.2): Dialog.Popup's (`id`, `open`, `closedby`, `aria-labelledby` and\n * `aria-describedby` token-merged, `data-modal`, `suppressHydrationWarning`) and `role`.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport function AlertDialogPopup(props: AlertDialogPopupProps) {\n const ctx = useDialogContext(\"AlertDialog.Popup\");\n const [cancels] = useState(() => new Set<HTMLElement>());\n const defaultFocus = props.initialFocus === undefined;\n const cancelContext = useMemo<AlertDialogCancelContextValue>(\n () => ({\n defaultFocus,\n register: (element) => {\n cancels.add(element);\n return () => cancels.delete(element);\n },\n }),\n [defaultFocus, cancels],\n );\n\n // Development check (design 2.2): the APG asks for the alert message as the description: a\n // mounted Description, or a consumer `aria-describedby` naming an element, by the end of the\n // dialog's first showing.\n useShownDescriptionWarning(\n ctx.popupRef,\n isDev &&\n \"AlertDialog.Popup: the alert dialog has no description. Render an \" +\n \"AlertDialog.Description with the message (or give the Popup an `aria-describedby`): a \" +\n \"screen reader announces an alert dialog by its name and description.\",\n );\n\n return useDialogPopup(\n // An untyped `lightDismiss` / `experimental_closedBy` is overridden: no light dismiss, no\n // `closedby` (design 2.3).\n { ...props, lightDismiss: false, experimental_closedBy: false },\n {\n namespace: \"AlertDialog\",\n role: \"alertdialog\",\n defaultInitialFocus: (dialog) => firstEnabledCancel(dialog, cancels),\n wrapChildren: (children: ReactNode) => (\n <AlertDialogCancelContext value={cancelContext}>{children}</AlertDialogCancelContext>\n ),\n },\n );\n}\n\nAlertDialogPopup.displayName = \"AlertDialogPopup\";\n"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;;;;;;;;AAwCvC,SAAgB,iBAAiB,OAA8B;CAC7D,MAAM,MAAM,iBAAiB,mBAAmB;CAChD,MAAM,CAAC,WAAW,+BAAe,IAAI,IAAiB,CAAC;CACvD,MAAM,eAAe,MAAM,iBAAiB,KAAA;CAC5C,MAAM,gBAAgB,eACb;EACL;EACA,WAAW,YAAY;GACrB,QAAQ,IAAI,OAAO;GACnB,aAAa,QAAQ,OAAO,OAAO;EACrC;CACF,IACA,CAAC,cAAc,OAAO,CACxB;CAKA,2BACE,IAAI,UACJ,SACE,8NAGJ;CAEA,OAAO,eAGL;EAAE,GAAG;EAAO,cAAc;EAAO,uBAAuB;CAAM,GAC9D;EACE,WAAW;EACX,MAAM;EACN,sBAAsB,WAAW,mBAAmB,QAAQ,OAAO;EACnE,eAAe,aACb,oBAAC,0BAAD;GAA0B,OAAO;GAAgB;EAAmC,CAAA;CAExF,CACF;AACF;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DialogOpenChangeDetails, DialogRootProps, DialogRootState } from "../dialog/dialog-root.mjs";
|
|
2
|
+
//#region src/alert-dialog/alert-dialog-root.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Details passed as the second argument of `openChangeAction` and `onOpenChange`: Dialog's.
|
|
5
|
+
* `reason` is `"activate"` for the Trigger, a Cancel, an Action or a Form; `"dismiss"` for
|
|
6
|
+
* Escape, Android back or an assistive-technology dismiss (there is no light dismiss).
|
|
7
|
+
*/
|
|
8
|
+
export type AlertDialogOpenChangeDetails = DialogOpenChangeDetails;
|
|
9
|
+
/** State of `AlertDialog.Root`: Dialog's, with `modal` always `true`. */
|
|
10
|
+
export type AlertDialogRootState = DialogRootState;
|
|
11
|
+
/**
|
|
12
|
+
* Props of `AlertDialog.Root`: `Dialog.Root`'s without `modal` (an alert dialog is always
|
|
13
|
+
* modal). Without `open`, `defaultOpen`, `openChangeAction` and `onOpenChange` it is JS-free.
|
|
14
|
+
*
|
|
15
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
16
|
+
*/
|
|
17
|
+
export type AlertDialogRootProps = Omit<DialogRootProps, "modal">;
|
|
18
|
+
/**
|
|
19
|
+
* `Dialog.Root` with `modal` fixed to `true` (design 2.1). Owns the ids, the mode and the open
|
|
20
|
+
* state; renders no DOM. The confirmed work belongs in `AlertDialog.Action`'s `action`;
|
|
21
|
+
* `openChangeAction` hears the Trigger, Cancel, Action and Form requests, `onOpenChange` the
|
|
22
|
+
* dismissals (Escape: a fact, it means "cancel").
|
|
23
|
+
*
|
|
24
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
25
|
+
*/
|
|
26
|
+
export declare function AlertDialogRoot(props: AlertDialogRootProps): import("react").ReactNode;
|
|
27
|
+
export declare namespace AlertDialogRoot {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//# sourceMappingURL=alert-dialog-root.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-root.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-root.tsx"],"mappings":";;;;;;;YAaY,+BAA+B;;YAG/B,uBAAuB;;;;;;;YAQvB,uBAAuB,KAAK;;;;;;;;;wBAUxB,gBAAgB,OAAO,uCAAoB;yBAA3C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useDialogRoot } from "../dialog/dialog-root.mjs";
|
|
3
|
+
//#region src/alert-dialog/alert-dialog-root.tsx
|
|
4
|
+
/**
|
|
5
|
+
* `Dialog.Root` with `modal` fixed to `true` (design 2.1). Owns the ids, the mode and the open
|
|
6
|
+
* state; renders no DOM. The confirmed work belongs in `AlertDialog.Action`'s `action`;
|
|
7
|
+
* `openChangeAction` hears the Trigger, Cancel, Action and Form requests, `onOpenChange` the
|
|
8
|
+
* dismissals (Escape: a fact, it means "cancel").
|
|
9
|
+
*
|
|
10
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
11
|
+
*/
|
|
12
|
+
function AlertDialogRoot(props) {
|
|
13
|
+
return useDialogRoot(props, {
|
|
14
|
+
namespace: "AlertDialog",
|
|
15
|
+
modal: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
AlertDialogRoot.displayName = "AlertDialogRoot";
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AlertDialogRoot };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=alert-dialog-root.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-root.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-root.tsx"],"sourcesContent":["\"use client\";\nimport { useDialogRoot } from \"../dialog/dialog-root.js\";\nimport type {\n DialogOpenChangeDetails,\n DialogRootProps,\n DialogRootState,\n} from \"../dialog/dialog-root.js\";\n\n/**\n * Details passed as the second argument of `openChangeAction` and `onOpenChange`: Dialog's.\n * `reason` is `\"activate\"` for the Trigger, a Cancel, an Action or a Form; `\"dismiss\"` for\n * Escape, Android back or an assistive-technology dismiss (there is no light dismiss).\n */\nexport type AlertDialogOpenChangeDetails = DialogOpenChangeDetails;\n\n/** State of `AlertDialog.Root`: Dialog's, with `modal` always `true`. */\nexport type AlertDialogRootState = DialogRootState;\n\n/**\n * Props of `AlertDialog.Root`: `Dialog.Root`'s without `modal` (an alert dialog is always\n * modal). Without `open`, `defaultOpen`, `openChangeAction` and `onOpenChange` it is JS-free.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport type AlertDialogRootProps = Omit<DialogRootProps, \"modal\">;\n\n/**\n * `Dialog.Root` with `modal` fixed to `true` (design 2.1). Owns the ids, the mode and the open\n * state; renders no DOM. The confirmed work belongs in `AlertDialog.Action`'s `action`;\n * `openChangeAction` hears the Trigger, Cancel, Action and Form requests, `onOpenChange` the\n * dismissals (Escape: a fact, it means \"cancel\").\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport function AlertDialogRoot(props: AlertDialogRootProps) {\n // `useDialogRoot` reads only the open-state props and `children`: an untyped `modal` is\n // dropped.\n return useDialogRoot(props, { namespace: \"AlertDialog\", modal: true });\n}\n\nAlertDialogRoot.displayName = \"AlertDialogRoot\";\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgB,gBAAgB,OAA6B;CAG3D,OAAO,cAAc,OAAO;EAAE,WAAW;EAAe,OAAO;CAAK,CAAC;AACvE;AAEA,gBAAgB,cAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DialogTitleProps, DialogTitleState } from "../dialog/dialog-title.mjs";
|
|
2
|
+
//#region src/alert-dialog/alert-dialog-title.d.ts
|
|
3
|
+
/** State of `AlertDialog.Title`: the Popup's state. */
|
|
4
|
+
export type AlertDialogTitleState = DialogTitleState;
|
|
5
|
+
/**
|
|
6
|
+
* Props of `AlertDialog.Title`: `Dialog.Title`'s.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
9
|
+
*/
|
|
10
|
+
export type AlertDialogTitleProps = DialogTitleProps;
|
|
11
|
+
/**
|
|
12
|
+
* The alert dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.
|
|
13
|
+
*
|
|
14
|
+
* Owned key (conventions 1.2): `id`.
|
|
15
|
+
*
|
|
16
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
17
|
+
*/
|
|
18
|
+
export declare function AlertDialogTitle(props: AlertDialogTitleProps): import("react").ReactNode;
|
|
19
|
+
export declare namespace AlertDialogTitle {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//# sourceMappingURL=alert-dialog-title.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-title.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-title.tsx"],"mappings":";;;YAKY,wBAAwB;;;;;;YAOxB,wBAAwB;;;;;;;;wBASpB,iBAAiB,OAAO,wCAAqB;yBAA7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useDialogTitle } from "../dialog/dialog-title.mjs";
|
|
3
|
+
//#region src/alert-dialog/alert-dialog-title.tsx
|
|
4
|
+
/**
|
|
5
|
+
* The alert dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.
|
|
6
|
+
*
|
|
7
|
+
* Owned key (conventions 1.2): `id`.
|
|
8
|
+
*
|
|
9
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
10
|
+
*/
|
|
11
|
+
function AlertDialogTitle(props) {
|
|
12
|
+
return useDialogTitle(props, "AlertDialog");
|
|
13
|
+
}
|
|
14
|
+
AlertDialogTitle.displayName = "AlertDialogTitle";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AlertDialogTitle };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=alert-dialog-title.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-title.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-title.tsx"],"sourcesContent":["\"use client\";\nimport { useDialogTitle } from \"../dialog/dialog-title.js\";\nimport type { DialogTitleProps, DialogTitleState } from \"../dialog/dialog-title.js\";\n\n/** State of `AlertDialog.Title`: the Popup's state. */\nexport type AlertDialogTitleState = DialogTitleState;\n\n/**\n * Props of `AlertDialog.Title`: `Dialog.Title`'s.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport type AlertDialogTitleProps = DialogTitleProps;\n\n/**\n * The alert dialog's name: an `<h2>` whose id the Popup references with `aria-labelledby`.\n *\n * Owned key (conventions 1.2): `id`.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport function AlertDialogTitle(props: AlertDialogTitleProps) {\n return useDialogTitle(props, \"AlertDialog\");\n}\n\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,iBAAiB,OAA8B;CAC7D,OAAO,eAAe,OAAO,aAAa;AAC5C;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DialogTriggerProps, DialogTriggerState } from "../dialog/dialog-trigger.mjs";
|
|
2
|
+
//#region src/alert-dialog/alert-dialog-trigger.d.ts
|
|
3
|
+
/** State of `AlertDialog.Trigger`: Dialog's. */
|
|
4
|
+
export type AlertDialogTriggerState = DialogTriggerState;
|
|
5
|
+
/**
|
|
6
|
+
* Props of `AlertDialog.Trigger`: `Dialog.Trigger`'s.
|
|
7
|
+
*
|
|
8
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
9
|
+
*/
|
|
10
|
+
export type AlertDialogTriggerProps = DialogTriggerProps;
|
|
11
|
+
/**
|
|
12
|
+
* The opener: `<button type="button" commandfor command="show-modal">`, exactly
|
|
13
|
+
* `Dialog.Trigger`. JS-free mode: the browser runs the command. Library mode: the click is a
|
|
14
|
+
* request through the Root (`data-pending` until the dialog has opened).
|
|
15
|
+
*
|
|
16
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
17
|
+
*/
|
|
18
|
+
export declare function AlertDialogTrigger(props: AlertDialogTriggerProps): import("react").ReactNode;
|
|
19
|
+
export declare namespace AlertDialogTrigger {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//# sourceMappingURL=alert-dialog-trigger.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-trigger.d.mts","names":[],"sources":["../../src/alert-dialog/alert-dialog-trigger.tsx"],"mappings":";;;YAKY,0BAA0B;;;;;;YAO1B,0BAA0B;;;;;;;;wBAStB,mBAAmB,OAAO,0CAAuB;yBAAjD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useDialogTrigger } from "../dialog/dialog-trigger.mjs";
|
|
3
|
+
//#region src/alert-dialog/alert-dialog-trigger.tsx
|
|
4
|
+
/**
|
|
5
|
+
* The opener: `<button type="button" commandfor command="show-modal">`, exactly
|
|
6
|
+
* `Dialog.Trigger`. JS-free mode: the browser runs the command. Library mode: the click is a
|
|
7
|
+
* request through the Root (`data-pending` until the dialog has opened).
|
|
8
|
+
*
|
|
9
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
10
|
+
*/
|
|
11
|
+
function AlertDialogTrigger(props) {
|
|
12
|
+
return useDialogTrigger(props, "AlertDialog");
|
|
13
|
+
}
|
|
14
|
+
AlertDialogTrigger.displayName = "AlertDialogTrigger";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AlertDialogTrigger };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=alert-dialog-trigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog-trigger.mjs","names":[],"sources":["../../src/alert-dialog/alert-dialog-trigger.tsx"],"sourcesContent":["\"use client\";\nimport { useDialogTrigger } from \"../dialog/dialog-trigger.js\";\nimport type { DialogTriggerProps, DialogTriggerState } from \"../dialog/dialog-trigger.js\";\n\n/** State of `AlertDialog.Trigger`: Dialog's. */\nexport type AlertDialogTriggerState = DialogTriggerState;\n\n/**\n * Props of `AlertDialog.Trigger`: `Dialog.Trigger`'s.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport type AlertDialogTriggerProps = DialogTriggerProps;\n\n/**\n * The opener: `<button type=\"button\" commandfor command=\"show-modal\">`, exactly\n * `Dialog.Trigger`. JS-free mode: the browser runs the command. Library mode: the click is a\n * request through the Root (`data-pending` until the dialog has opened).\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport function AlertDialogTrigger(props: AlertDialogTriggerProps) {\n return useDialogTrigger(props, \"AlertDialog\");\n}\n\nAlertDialogTrigger.displayName = \"AlertDialogTrigger\";\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,mBAAmB,OAAgC;CACjE,OAAO,iBAAiB,OAAO,aAAa;AAC9C;AAEA,mBAAmB,cAAc"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../internal/platform-attributes.mjs";
|
|
2
|
+
import { AlertDialogAction, AlertDialogActionDetails, AlertDialogActionProps, AlertDialogActionState } from "./alert-dialog-action.mjs";
|
|
3
|
+
import { AlertDialogCancel, AlertDialogCancelDetails, AlertDialogCancelProps, AlertDialogCancelState } from "./alert-dialog-cancel.mjs";
|
|
4
|
+
import { AlertDialogDescription, AlertDialogDescriptionProps, AlertDialogDescriptionState } from "./alert-dialog-description.mjs";
|
|
5
|
+
import { AlertDialogForm, AlertDialogFormProps, AlertDialogFormState } from "./alert-dialog-form.mjs";
|
|
6
|
+
import { AlertDialogPopup, AlertDialogPopupProps, AlertDialogPopupState } from "./alert-dialog-popup.mjs";
|
|
7
|
+
import { AlertDialogOpenChangeDetails, AlertDialogRoot, AlertDialogRootProps, AlertDialogRootState } from "./alert-dialog-root.mjs";
|
|
8
|
+
import { AlertDialogTitle, AlertDialogTitleProps, AlertDialogTitleState } from "./alert-dialog-title.mjs";
|
|
9
|
+
import { AlertDialogTrigger, AlertDialogTriggerProps, AlertDialogTriggerState } from "./alert-dialog-trigger.mjs";
|
|
10
|
+
//#region src/alert-dialog/index.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* A Dialog with alert defaults: `Root` (no DOM) > `Trigger` + `Popup`
|
|
13
|
+
* (`dialog[role=alertdialog]`, always modal, no light dismiss) > `Title`, `Description`,
|
|
14
|
+
* `Cancel` (focused on open), `Action` (runs its `action`, pending, then closes; stays open on
|
|
15
|
+
* rejection), `Form` (the confirm that works without JavaScript). Escape closes it, as a
|
|
16
|
+
* dismissal reported to `onOpenChange`. Every part runs the code of the matching Dialog part,
|
|
17
|
+
* so the styling surface and the transition types (`fsui-dialog*`) are Dialog's.
|
|
18
|
+
*
|
|
19
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
20
|
+
*/
|
|
21
|
+
export declare const AlertDialog: {
|
|
22
|
+
readonly Root: typeof AlertDialogRoot;
|
|
23
|
+
readonly Trigger: typeof AlertDialogTrigger;
|
|
24
|
+
readonly Popup: typeof AlertDialogPopup;
|
|
25
|
+
readonly Title: typeof AlertDialogTitle;
|
|
26
|
+
readonly Description: typeof AlertDialogDescription;
|
|
27
|
+
readonly Cancel: typeof AlertDialogCancel;
|
|
28
|
+
readonly Action: typeof AlertDialogAction;
|
|
29
|
+
readonly Form: typeof AlertDialogForm;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export type { AlertDialogActionDetails, AlertDialogActionProps, AlertDialogActionState, AlertDialogCancelDetails, AlertDialogCancelProps, AlertDialogCancelState, AlertDialogDescriptionProps, AlertDialogDescriptionState, AlertDialogFormProps, AlertDialogFormState, AlertDialogOpenChangeDetails, AlertDialogPopupProps, AlertDialogPopupState, AlertDialogRootProps, AlertDialogRootState, AlertDialogTitleProps, AlertDialogTitleState, AlertDialogTriggerProps, AlertDialogTriggerState };
|
|
33
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/alert-dialog/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;qBAsBa;WACX,aAAI;WACJ,gBAAO;WACP,cAAK;WACL,cAAK;WACL,oBAAW;WACX,eAAM;WACN,eAAM;WACN,aAAI"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AlertDialogAction } from "./alert-dialog-action.mjs";
|
|
2
|
+
import { AlertDialogCancel } from "./alert-dialog-cancel.mjs";
|
|
3
|
+
import { AlertDialogDescription } from "./alert-dialog-description.mjs";
|
|
4
|
+
import { AlertDialogForm } from "./alert-dialog-form.mjs";
|
|
5
|
+
import { AlertDialogPopup } from "./alert-dialog-popup.mjs";
|
|
6
|
+
import { AlertDialogRoot } from "./alert-dialog-root.mjs";
|
|
7
|
+
import { AlertDialogTitle } from "./alert-dialog-title.mjs";
|
|
8
|
+
import { AlertDialogTrigger } from "./alert-dialog-trigger.mjs";
|
|
9
|
+
//#region src/alert-dialog/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* A Dialog with alert defaults: `Root` (no DOM) > `Trigger` + `Popup`
|
|
12
|
+
* (`dialog[role=alertdialog]`, always modal, no light dismiss) > `Title`, `Description`,
|
|
13
|
+
* `Cancel` (focused on open), `Action` (runs its `action`, pending, then closes; stays open on
|
|
14
|
+
* rejection), `Form` (the confirm that works without JavaScript). Escape closes it, as a
|
|
15
|
+
* dismissal reported to `onOpenChange`. Every part runs the code of the matching Dialog part,
|
|
16
|
+
* so the styling surface and the transition types (`fsui-dialog*`) are Dialog's.
|
|
17
|
+
*
|
|
18
|
+
* @see https://ui.funstack.work/components/alert-dialog
|
|
19
|
+
*/
|
|
20
|
+
const AlertDialog = {
|
|
21
|
+
Root: AlertDialogRoot,
|
|
22
|
+
Trigger: AlertDialogTrigger,
|
|
23
|
+
Popup: AlertDialogPopup,
|
|
24
|
+
Title: AlertDialogTitle,
|
|
25
|
+
Description: AlertDialogDescription,
|
|
26
|
+
Cancel: AlertDialogCancel,
|
|
27
|
+
Action: AlertDialogAction,
|
|
28
|
+
Form: AlertDialogForm
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AlertDialog };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/alert-dialog/index.ts"],"sourcesContent":["// Ships the platform attribute typings (`command`, `commandfor`) with this subpath\n// (conventions 7.4). Type-only: the built JS has no import of it.\nimport \"../internal/platform-attributes.js\";\nimport { AlertDialogAction } from \"./alert-dialog-action.js\";\nimport { AlertDialogCancel } from \"./alert-dialog-cancel.js\";\nimport { AlertDialogDescription } from \"./alert-dialog-description.js\";\nimport { AlertDialogForm } from \"./alert-dialog-form.js\";\nimport { AlertDialogPopup } from \"./alert-dialog-popup.js\";\nimport { AlertDialogRoot } from \"./alert-dialog-root.js\";\nimport { AlertDialogTitle } from \"./alert-dialog-title.js\";\nimport { AlertDialogTrigger } from \"./alert-dialog-trigger.js\";\n\n/**\n * A Dialog with alert defaults: `Root` (no DOM) > `Trigger` + `Popup`\n * (`dialog[role=alertdialog]`, always modal, no light dismiss) > `Title`, `Description`,\n * `Cancel` (focused on open), `Action` (runs its `action`, pending, then closes; stays open on\n * rejection), `Form` (the confirm that works without JavaScript). Escape closes it, as a\n * dismissal reported to `onOpenChange`. Every part runs the code of the matching Dialog part,\n * so the styling surface and the transition types (`fsui-dialog*`) are Dialog's.\n *\n * @see https://ui.funstack.work/components/alert-dialog\n */\nexport const AlertDialog = {\n Root: AlertDialogRoot,\n Trigger: AlertDialogTrigger,\n Popup: AlertDialogPopup,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n Cancel: AlertDialogCancel,\n Action: AlertDialogAction,\n Form: AlertDialogForm,\n} as const;\n\nexport type {\n AlertDialogRootProps,\n AlertDialogRootState,\n AlertDialogOpenChangeDetails,\n} from \"./alert-dialog-root.js\";\nexport type { AlertDialogTriggerProps, AlertDialogTriggerState } from \"./alert-dialog-trigger.js\";\nexport type { AlertDialogPopupProps, AlertDialogPopupState } from \"./alert-dialog-popup.js\";\nexport type { AlertDialogTitleProps, AlertDialogTitleState } from \"./alert-dialog-title.js\";\nexport type {\n AlertDialogDescriptionProps,\n AlertDialogDescriptionState,\n} from \"./alert-dialog-description.js\";\nexport type {\n AlertDialogCancelProps,\n AlertDialogCancelState,\n AlertDialogCancelDetails,\n} from \"./alert-dialog-cancel.js\";\nexport type {\n AlertDialogActionProps,\n AlertDialogActionState,\n AlertDialogActionDetails,\n} from \"./alert-dialog-action.js\";\nexport type { AlertDialogFormProps, AlertDialogFormState } from \"./alert-dialog-form.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,cAAc;CACzB,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,MAAM;AACR"}
|
|
@@ -5,8 +5,8 @@ import { useRender } from "../internal/use-render.mjs";
|
|
|
5
5
|
import { syncPresences } from "../internal/form/sync-presence.mjs";
|
|
6
6
|
import { useFormReset } from "../internal/form/use-form-reset.mjs";
|
|
7
7
|
import { guardCheckableChange, useNativeChecked } from "../internal/form/use-native-checked.mjs";
|
|
8
|
-
import { enabledValues, useCheckboxGroupContext } from "./checkbox-group-context.mjs";
|
|
9
8
|
import { useHydratedMount } from "../internal/use-hydrated-mount.mjs";
|
|
9
|
+
import { enabledValues, useCheckboxGroupContext } from "./checkbox-group-context.mjs";
|
|
10
10
|
import { useCallback, useLayoutEffect, useMemo, useRef } from "react";
|
|
11
11
|
//#region src/checkbox-group/checkbox-group-parent.tsx
|
|
12
12
|
/** `checked` / `indeterminate` of a Parent over `values` against `set` (design 6.1). */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-context.mjs","names":[],"sources":["../../src/collapsible/collapsible-context.ts"],"sourcesContent":["\"use client\";\nimport { createContext } from \"react\";\n\n/** What `Collapsible.Trigger` and `Collapsible.Panel` read from the Root (memoised). */\nexport interface CollapsibleContextValue {\n /** Library mode (design/components/collapsible.md 2): the Root has `open`, `defaultOpen` or `openChangeAction`. */\n readonly library: boolean;\n readonly disabled: boolean;\n /** The Root's transition is pending (library mode only). */\n readonly pending: boolean;\n /** Committed open state; `undefined` in JS-free mode (browser-owned, unknown to React). */\n readonly committedOpen: boolean | undefined;\n /** Optimistic open state; `undefined` in JS-free mode. */\n readonly optimisticOpen: boolean | undefined;\n /** The Trigger was activated: dispatch `open` with reason \"activate\" (library mode; stable). */\n readonly dispatch: (open: boolean, event: Event) => void;\n}\n\nexport const CollapsibleContext = createContext<CollapsibleContextValue | null>(null);\n"],"mappings":";;;AAkBA,MAAa,qBAAqB,cAA8C,IAAI"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
3
|
+
//#region src/collapsible/collapsible-panel.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* State of `Collapsible.Panel`, passed to the function forms of `className`, `style`, `children`
|
|
6
|
+
* and `render`.
|
|
7
|
+
*/
|
|
8
|
+
export interface CollapsiblePanelState {
|
|
9
|
+
/** Committed open state. `undefined` in JS-free mode. */
|
|
10
|
+
readonly open: boolean | undefined;
|
|
11
|
+
/** The Root's `disabled` prop. */
|
|
12
|
+
readonly disabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Props of `Collapsible.Panel`.
|
|
16
|
+
*
|
|
17
|
+
* @see https://ui.funstack.work/components/collapsible
|
|
18
|
+
*/
|
|
19
|
+
export interface CollapsiblePanelProps extends Omit<ComponentPropsWithRef<"div">, "className" | "style" | "children"> {
|
|
20
|
+
/**
|
|
21
|
+
* Library mode only. Forwarded as `default` to the `<ViewTransition>` around the panel's
|
|
22
|
+
* `div`; animates content that mounts or changes in the commit that ends an action.
|
|
23
|
+
*
|
|
24
|
+
* Static: setting or unsetting it remounts the element. Any value, `"none"` included, makes a
|
|
25
|
+
* mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms
|
|
26
|
+
* page cross-fade that the next transition waits for).
|
|
27
|
+
*/
|
|
28
|
+
transition?: ViewTransitionClass;
|
|
29
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
30
|
+
className?: StateValue<string | undefined, CollapsiblePanelState>;
|
|
31
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
32
|
+
style?: StateValue<CSSProperties | undefined, CollapsiblePanelState>;
|
|
33
|
+
/**
|
|
34
|
+
* Always mounted (closed `<details>` content stays in the DOM, indexable and searchable). The
|
|
35
|
+
* function form receives committed `open`, which is how content is mounted lazily and how
|
|
36
|
+
* suspending content keeps the Collapsible closed until it is ready (library mode).
|
|
37
|
+
*/
|
|
38
|
+
children?: StateValue<ReactNode, CollapsiblePanelState>;
|
|
39
|
+
/** Replace the default `<div>` (element form) or take over rendering (function form). */
|
|
40
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, CollapsiblePanelState>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The content region: a `div` inside the `<details>`, after the Trigger. Its visibility is the
|
|
44
|
+
* Root's `open` attribute (`details:open > .panel`); it renders committed state.
|
|
45
|
+
*
|
|
46
|
+
* @see https://ui.funstack.work/components/collapsible
|
|
47
|
+
*/
|
|
48
|
+
export declare function CollapsiblePanel({ transition, className, style, children, render, ...rest }: CollapsiblePanelProps): ReactNode;
|
|
49
|
+
export declare namespace CollapsiblePanel {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//# sourceMappingURL=collapsible-panel.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-panel.d.mts","names":[],"sources":["../../src/collapsible/collapsible-panel.tsx"],"mappings":";;;;;;;iBAgBiB;;WAEN;;WAEA;;;;;;;iBAQM,8BAA8B,KAC7C;;;;;;;;;EAWA,aAAa;;EAEb,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;;;;;EAM9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,8BAA8B;;;;;;;;wBASpC,mBACd,YACA,WACA,OACA,UACA,WACG,QACF,wBAAqB;yBAPR"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
+
import { CollapsibleContext } from "./collapsible-context.mjs";
|
|
7
|
+
import { use } from "react";
|
|
8
|
+
//#region src/collapsible/collapsible-panel.tsx
|
|
9
|
+
const isDev = process.env.NODE_ENV !== "production";
|
|
10
|
+
/**
|
|
11
|
+
* The content region: a `div` inside the `<details>`, after the Trigger. Its visibility is the
|
|
12
|
+
* Root's `open` attribute (`details:open > .panel`); it renders committed state.
|
|
13
|
+
*
|
|
14
|
+
* @see https://ui.funstack.work/components/collapsible
|
|
15
|
+
*/
|
|
16
|
+
function CollapsiblePanel({ transition, className, style, children, render, ...rest }) {
|
|
17
|
+
const root = use(CollapsibleContext);
|
|
18
|
+
if (root === null) throw new Error("Collapsible.Panel must be rendered inside a Collapsible.Root.");
|
|
19
|
+
const isLibrary = root.library;
|
|
20
|
+
useDevWarning(!isLibrary && transition !== void 0, isDev && "Collapsible.Panel: `transition` has no effect in JS-free mode; the browser toggles the <details> outside any React transition.");
|
|
21
|
+
const state = {
|
|
22
|
+
open: root.committedOpen,
|
|
23
|
+
disabled: root.disabled
|
|
24
|
+
};
|
|
25
|
+
const element = useRender({
|
|
26
|
+
defaultElement: "div",
|
|
27
|
+
render,
|
|
28
|
+
state,
|
|
29
|
+
className,
|
|
30
|
+
style,
|
|
31
|
+
children,
|
|
32
|
+
props: rest,
|
|
33
|
+
libraryProps: { "data-disabled": dataAttr(root.disabled) }
|
|
34
|
+
});
|
|
35
|
+
return useTransitionBoundary("Collapsible.Panel", isLibrary ? transition : void 0, element);
|
|
36
|
+
}
|
|
37
|
+
CollapsiblePanel.displayName = "CollapsiblePanel";
|
|
38
|
+
//#endregion
|
|
39
|
+
export { CollapsiblePanel };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=collapsible-panel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-panel.mjs","names":[],"sources":["../../src/collapsible/collapsible-panel.tsx"],"sourcesContent":["\"use client\";\nimport { use } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, ViewTransitionClass } from \"react\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { CollapsibleContext } from \"./collapsible-context.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/**\n * State of `Collapsible.Panel`, passed to the function forms of `className`, `style`, `children`\n * and `render`.\n */\nexport interface CollapsiblePanelState {\n /** Committed open state. `undefined` in JS-free mode. */\n readonly open: boolean | undefined;\n /** The Root's `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/**\n * Props of `Collapsible.Panel`.\n *\n * @see https://ui.funstack.work/components/collapsible\n */\nexport interface CollapsiblePanelProps extends Omit<\n ComponentPropsWithRef<\"div\">,\n \"className\" | \"style\" | \"children\"\n> {\n /**\n * Library mode only. Forwarded as `default` to the `<ViewTransition>` around the panel's\n * `div`; animates content that mounts or changes in the commit that ends an action.\n *\n * Static: setting or unsetting it remounts the element. Any value, `\"none\"` included, makes a\n * mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms\n * page cross-fade that the next transition waits for).\n */\n transition?: ViewTransitionClass;\n /** Class name, or a function of the part's state that returns one. */\n className?: StateValue<string | undefined, CollapsiblePanelState>;\n /** Inline style, or a function of the part's state that returns one. */\n style?: StateValue<CSSProperties | undefined, CollapsiblePanelState>;\n /**\n * Always mounted (closed `<details>` content stays in the DOM, indexable and searchable). The\n * function form receives committed `open`, which is how content is mounted lazily and how\n * suspending content keeps the Collapsible closed until it is ready (library mode).\n */\n children?: StateValue<ReactNode, CollapsiblePanelState>;\n /** Replace the default `<div>` (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"div\">, CollapsiblePanelState>;\n}\n\n/**\n * The content region: a `div` inside the `<details>`, after the Trigger. Its visibility is the\n * Root's `open` attribute (`details:open > .panel`); it renders committed state.\n *\n * @see https://ui.funstack.work/components/collapsible\n */\nexport function CollapsiblePanel({\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: CollapsiblePanelProps) {\n const root = use(CollapsibleContext);\n if (root === null) {\n throw new Error(\"Collapsible.Panel must be rendered inside a Collapsible.Root.\");\n }\n const isLibrary = root.library;\n\n useDevWarning(\n !isLibrary && transition !== undefined,\n isDev &&\n \"Collapsible.Panel: `transition` has no effect in JS-free mode; the browser toggles the \" +\n \"<details> outside any React transition.\",\n );\n\n const state: CollapsiblePanelState = { open: root.committedOpen, disabled: root.disabled };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, CollapsiblePanelState>({\n defaultElement: \"div\",\n render,\n state,\n className,\n style,\n children,\n props: rest,\n libraryProps: {\n \"data-disabled\": dataAttr(root.disabled),\n },\n });\n\n return useTransitionBoundary(\"Collapsible.Panel\", isLibrary ? transition : undefined, element);\n}\n\nCollapsiblePanel.displayName = \"CollapsiblePanel\";\n"],"mappings":";;;;;;;;AAUA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;;AAmDvC,SAAgB,iBAAiB,EAC/B,YACA,WACA,OACA,UACA,QACA,GAAG,QACqB;CACxB,MAAM,OAAO,IAAI,kBAAkB;CACnC,IAAI,SAAS,MACX,MAAM,IAAI,MAAM,+DAA+D;CAEjF,MAAM,YAAY,KAAK;CAEvB,cACE,CAAC,aAAa,eAAe,KAAA,GAC7B,SACE,gIAEJ;CAEA,MAAM,QAA+B;EAAE,MAAM,KAAK;EAAe,UAAU,KAAK;CAAS;CAEzF,MAAM,UAAU,UAA+D;EAC7E,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc,EACZ,iBAAiB,SAAS,KAAK,QAAQ,EACzC;CACF,CAAC;CAED,OAAO,sBAAsB,qBAAqB,YAAY,aAAa,KAAA,GAAW,OAAO;AAC/F;AAEA,iBAAiB,cAAc"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode, ViewTransitionClass } from "react";
|
|
3
|
+
//#region src/collapsible/collapsible-root.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* State of `Collapsible.Root`, passed to the function forms of `className`, `style`, `children`
|
|
6
|
+
* and `render`.
|
|
7
|
+
*/
|
|
8
|
+
export interface CollapsibleRootState {
|
|
9
|
+
/** Optimistic open state. `undefined` in JS-free mode (browser-owned, unknown to React). */
|
|
10
|
+
readonly open: boolean | undefined;
|
|
11
|
+
/** An action dispatched through this Collapsible is in flight (library mode only). */
|
|
12
|
+
readonly pending: boolean;
|
|
13
|
+
/** The Root's `disabled` prop. */
|
|
14
|
+
readonly disabled: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Details passed as the second argument of `openChangeAction`. */
|
|
17
|
+
export interface CollapsibleOpenChangeDetails extends ActionDetails {
|
|
18
|
+
/**
|
|
19
|
+
* The shared vocabulary (conventions 2.2); Collapsible dispatches two of its values.
|
|
20
|
+
* `"activate"`: the user activated the Trigger. `"platform"`: the browser changed `open` itself
|
|
21
|
+
* (find-in-page, a text fragment, a click before hydration); `event` is then the `toggle`
|
|
22
|
+
* event, or `undefined` when the mismatch was found on mount.
|
|
23
|
+
*/
|
|
24
|
+
readonly reason: ChangeReason;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Props of `Collapsible.Root`.
|
|
28
|
+
*
|
|
29
|
+
* Without `open`, `defaultOpen` and `openChangeAction` the Collapsible runs in **JS-free mode**:
|
|
30
|
+
* the browser owns `<details open>` and nothing runs on toggle. With any of them it runs in
|
|
31
|
+
* **library mode**: the summary click is intercepted, `open` follows committed state inside a
|
|
32
|
+
* transition, and the Root and Trigger show optimistic `data-open`.
|
|
33
|
+
*
|
|
34
|
+
* @see https://ui.funstack.work/components/collapsible
|
|
35
|
+
*/
|
|
36
|
+
export interface CollapsibleRootProps extends Omit<ComponentPropsWithRef<"details">, "open" | "name" | "onToggle" | "className" | "style" | "children"> {
|
|
37
|
+
/** Controlled open state. `undefined` means uncontrolled. Selects library mode. */
|
|
38
|
+
open?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Initial open state, uncontrolled. Read once. Its presence selects library mode,
|
|
41
|
+
* `defaultOpen={false}` included. Library mode without it (`open` or `openChangeAction` only)
|
|
42
|
+
* starts closed, as `false`.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue none (JS-free mode)
|
|
45
|
+
*/
|
|
46
|
+
defaultOpen?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Called with the next open state on every change, inside the Root's transition; may be sync or
|
|
49
|
+
* async (also a Server Function). Rejections reach the nearest Error Boundary. Selects library
|
|
50
|
+
* mode.
|
|
51
|
+
*
|
|
52
|
+
* Also called with `details.reason === "platform"` when the browser opened or closed the
|
|
53
|
+
* `<details>` itself (find-in-page, a click before hydration). The revealed content stays
|
|
54
|
+
* visible while the action runs; if a controlled parent does not adopt the change, committed
|
|
55
|
+
* state is re-applied to the DOM (closed again) once the action settles. A rejection goes to the
|
|
56
|
+
* Error Boundary like any other.
|
|
57
|
+
*
|
|
58
|
+
* A `setState` placed after your own `await` is not a Transition update; wrap it in
|
|
59
|
+
* `startTransition` (React limitation).
|
|
60
|
+
*/
|
|
61
|
+
openChangeAction?: ChangeAction<boolean, CollapsibleOpenChangeDetails>;
|
|
62
|
+
/**
|
|
63
|
+
* The Trigger renders `aria-disabled` and never toggles. Enforced by a click handler, so in
|
|
64
|
+
* JS-free mode it does not hold before hydration or with JS off.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `false`
|
|
67
|
+
*/
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Renders `interpolate-size: allow-keywords` on the `<details>` so `::details-content` can
|
|
71
|
+
* transition `height` to `auto`. Chromium-only polish today; use the `grid-template-rows` form
|
|
72
|
+
* for a cross-engine animation. Merged with `style`; the consumer's declaration wins.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue `false`
|
|
75
|
+
*/
|
|
76
|
+
experimental_interpolateSize?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Library mode only. Forwarded as `default` to the `<ViewTransition>` around the `<details>`;
|
|
79
|
+
* animates the commit that ends an action (the `open` attribute flip), not the optimistic
|
|
80
|
+
* `data-open` flip. Ignored (dev warning) in JS-free mode.
|
|
81
|
+
*
|
|
82
|
+
* Static: setting or unsetting it remounts the element. Any value, `"none"` included, makes a
|
|
83
|
+
* mount or `<Activity>` reveal inside a transition start a document view transition (a ~250 ms
|
|
84
|
+
* page cross-fade that the next transition waits for).
|
|
85
|
+
*/
|
|
86
|
+
transition?: ViewTransitionClass;
|
|
87
|
+
/** Class name, or a function of the part's state that returns one. */
|
|
88
|
+
className?: StateValue<string | undefined, CollapsibleRootState>;
|
|
89
|
+
/** Inline style, or a function of the part's state that returns one. */
|
|
90
|
+
style?: StateValue<CSSProperties | undefined, CollapsibleRootState>;
|
|
91
|
+
/** Content, or a function of the part's state. The Trigger must be the first child. */
|
|
92
|
+
children?: StateValue<ReactNode, CollapsibleRootState>;
|
|
93
|
+
/** Must render a `<details>` element. */
|
|
94
|
+
render?: RenderProp<ComponentPropsWithRef<"details">, CollapsibleRootState>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* One disclosure: the `<details>` element, which owns the open state and the transition. In
|
|
98
|
+
* library mode its `open` attribute follows committed state and `data-open` / `data-pending`
|
|
99
|
+
* follow optimistic state; in JS-free mode the browser owns `open`.
|
|
100
|
+
*
|
|
101
|
+
* @see https://ui.funstack.work/components/collapsible
|
|
102
|
+
*/
|
|
103
|
+
export declare function CollapsibleRoot({ open, defaultOpen, openChangeAction, disabled, experimental_interpolateSize, transition, className, style, children, render, ...rest }: CollapsibleRootProps): ReactNode;
|
|
104
|
+
export declare namespace CollapsibleRoot {
|
|
105
|
+
var displayName: string;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//# sourceMappingURL=collapsible-root.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-root.d.mts","names":[],"sources":["../../src/collapsible/collapsible-root.tsx"],"mappings":";;;;;;;iBAqCiB;;WAEN;;WAEA;;WAEA;;;iBAIM,qCAAqC;;;;;;;WAO3C,QAAQ;;;;;;;;;;;;iBAaF,6BAA6B,KAC5C;;EAIA;;;;;;;;EAQA;;;;;;;;;;;;;;;EAeA,mBAAmB,sBAAsB;;;;;;;EAOzC;;;;;;;;EAQA;;;;;;;;;;EAUA,aAAa;;EAEb,YAAY,+BAA+B;;EAE3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,kCAAkC;;;;;;;;;wBAexC,kBACd,MACA,aACA,kBACA,UACA,8BACA,YACA,WACA,OACA,UACA,WACG,QACF,uBAAoB;yBAZP"}
|