@torpor/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/Accordion/Accordion.torp +44 -25
- package/dist/Accordion/AccordionContent.torp +18 -12
- package/dist/Accordion/AccordionHeader.torp +15 -8
- package/dist/Accordion/AccordionItem.torp +34 -17
- package/dist/Accordion/AccordionTrigger.torp +17 -10
- package/dist/Accordion/AccordionTypes.ts +6 -3
- package/dist/Accordion/index.d.ts +100 -35
- package/dist/Breadcrumb/Breadcrumb.torp +18 -10
- package/dist/Breadcrumb/BreadcrumbItem.torp +14 -7
- package/dist/Breadcrumb/BreadcrumbSeparator.torp +10 -3
- package/dist/Breadcrumb/index.d.ts +50 -21
- package/dist/Calendar/Calendar.torp +21 -14
- package/dist/Calendar/CalendarDay.torp +12 -4
- package/dist/Calendar/index.d.ts +16 -18
- package/dist/Contextual/Contextual.torp +125 -0
- package/dist/{Popover/PopoverContentContextual.torp → Contextual/ContextualContent.torp} +21 -12
- package/dist/Contextual/ContextualTrigger.torp +66 -0
- package/dist/Contextual/ContextualTypes.ts +30 -0
- package/dist/Contextual/index.d.ts +90 -0
- package/dist/Contextual/index.js +14 -0
- package/dist/Contextual/index.js.map +1 -0
- package/dist/Dialog/Dialog.torp +49 -73
- package/dist/Dialog/DialogBody.torp +15 -9
- package/dist/Dialog/DialogButton.torp +27 -13
- package/dist/Dialog/DialogFooter.torp +11 -3
- package/dist/Dialog/DialogHeader.torp +15 -8
- package/dist/Dialog/DialogTypes.ts +3 -2
- package/dist/Dialog/index.d.ts +83 -35
- package/dist/Disclosure/Disclosure.torp +34 -25
- package/dist/Disclosure/DisclosureContent.torp +18 -12
- package/dist/Disclosure/DisclosureHeader.torp +16 -9
- package/dist/Disclosure/DisclosureTrigger.torp +15 -8
- package/dist/Disclosure/DisclosureTypes.ts +0 -1
- package/dist/Disclosure/index.d.ts +67 -28
- package/dist/Drawer/Drawer.torp +109 -68
- package/dist/Drawer/DrawerContent.torp +80 -0
- package/dist/Drawer/DrawerOverlay.torp +38 -0
- package/dist/Drawer/DrawerTrigger.torp +35 -0
- package/dist/Drawer/DrawerTypes.ts +24 -0
- package/dist/Drawer/index.d.ts +96 -8
- package/dist/Drawer/index.js +13 -1
- package/dist/Form/Field.torp +91 -0
- package/dist/Form/Form.torp +129 -0
- package/dist/Form/FormTypes.ts +30 -0
- package/dist/Form/Input.torp +97 -0
- package/dist/Form/Label.torp +31 -0
- package/dist/Form/Message.torp +35 -0
- package/dist/Form/StandardSchemaV1.ts +70 -0
- package/dist/Form/index.d.ts +131 -0
- package/dist/Form/index.js +22 -0
- package/dist/Form/index.js.map +1 -0
- package/dist/Menu/Menu.torp +25 -15
- package/dist/Menu/MenuButton.torp +30 -13
- package/dist/Menu/MenuCheck.torp +29 -14
- package/dist/Menu/MenuGroup.torp +14 -6
- package/dist/Menu/MenuIndicator.torp +14 -7
- package/dist/Menu/MenuPopout.torp +23 -15
- package/dist/Menu/MenuPopoutContent.torp +17 -10
- package/dist/Menu/MenuPopoutTrigger.torp +23 -16
- package/dist/Menu/MenuRadio.torp +27 -16
- package/dist/Menu/MenuRadioGroup.torp +34 -15
- package/dist/Menu/MenuSeparator.torp +11 -3
- package/dist/Menu/MenuTypes.ts +7 -5
- package/dist/Menu/index.d.ts +176 -77
- package/dist/MenuBar/MenuBar.torp +24 -16
- package/dist/MenuBar/MenuBarItem.torp +24 -16
- package/dist/MenuBar/MenuBarItemContent.torp +18 -11
- package/dist/MenuBar/MenuBarItemTrigger.torp +15 -9
- package/dist/MenuBar/index.d.ts +79 -28
- package/dist/Modal/Modal.torp +118 -0
- package/dist/Modal/ModalContent.torp +77 -0
- package/dist/Modal/ModalOverlay.torp +38 -0
- package/dist/Modal/ModalTrigger.torp +50 -0
- package/dist/Modal/ModalTypes.ts +22 -0
- package/dist/Modal/index.d.ts +108 -0
- package/dist/Modal/index.js +33 -0
- package/dist/Modal/index.js.map +1 -0
- package/dist/Modal/showModal.ts +19 -0
- package/dist/Modal/showPrompt.ts +23 -0
- package/dist/NavMenu/NavMenu.torp +18 -10
- package/dist/NavMenu/NavMenuButton.torp +15 -10
- package/dist/NavMenu/NavMenuElement.torp +19 -11
- package/dist/NavMenu/NavMenuGroup.torp +13 -6
- package/dist/NavMenu/NavMenuGroupHeader.torp +15 -8
- package/dist/NavMenu/NavMenuLink.torp +21 -16
- package/dist/NavMenu/NavMenuPopout.torp +34 -18
- package/dist/NavMenu/NavMenuPopoutButton.torp +23 -18
- package/dist/NavMenu/NavMenuPopoutContent.torp +23 -13
- package/dist/NavMenu/NavMenuSeparator.torp +10 -3
- package/dist/NavMenu/index.d.ts +153 -70
- package/dist/Notification/Notification.torp +35 -16
- package/dist/Notification/NotificationClose.torp +10 -3
- package/dist/Notification/NotificationContainer.torp +11 -3
- package/dist/Notification/NotificationContent.torp +11 -3
- package/dist/Notification/index.d.ts +46 -28
- package/dist/Popover/Popover.torp +48 -28
- package/dist/Popover/PopoverContent.torp +42 -8
- package/dist/Popover/PopoverTrigger.torp +32 -3
- package/dist/Popover/PopoverTypes.ts +1 -1
- package/dist/Popover/index.d.ts +48 -111
- package/dist/Popover/index.js +1 -163
- package/dist/Popover/index.js.map +1 -1
- package/dist/TabGroup/TabContent.torp +20 -11
- package/dist/TabGroup/TabGroup.torp +58 -40
- package/dist/TabGroup/TabGroupTypes.ts +10 -5
- package/dist/TabGroup/TabHeader.torp +26 -10
- package/dist/TabGroup/TabList.torp +14 -7
- package/dist/TabGroup/TabTrigger.torp +17 -10
- package/dist/TabGroup/index.d.ts +101 -35
- package/dist/icons/ArrowDown.torp +5 -3
- package/dist/icons/ArrowLeft.torp +5 -3
- package/dist/icons/ArrowRight.torp +5 -3
- package/dist/icons/ArrowUp.torp +5 -3
- package/dist/icons/Bars.torp +5 -3
- package/dist/icons/Check.torp +5 -3
- package/dist/icons/ChevronDown.torp +5 -3
- package/dist/icons/ChevronLeft.torp +5 -3
- package/dist/icons/ChevronRight.torp +5 -3
- package/dist/icons/ChevronUp.torp +5 -3
- package/dist/icons/Cross.torp +5 -3
- package/dist/icons/IconTypes.ts +6 -0
- package/dist/icons/Loading.torp +5 -3
- package/dist/icons/Minus.torp +5 -3
- package/dist/icons/Plus.torp +5 -3
- package/dist/icons/index.d.ts +271 -126
- package/dist/index.d.ts +17 -4
- package/dist/metafile-esm.json +1 -1
- package/dist/motion/fade.ts +15 -6
- package/dist/motion/grow.ts +23 -0
- package/dist/motion/index.d.ts +19 -2
- package/dist/motion/index.js +93 -3
- package/dist/motion/index.js.map +1 -1
- package/dist/motion/measure.ts +28 -0
- package/dist/motion/slide.ts +45 -0
- package/dist/mount/clickPopover.ts +51 -0
- package/dist/mount/contextPopover.ts +51 -0
- package/dist/mount/hoverPopover.ts +58 -0
- package/package.json +28 -12
- package/scripts/postbuild.ts +11 -1
- package/src/Accordion/Accordion.torp +44 -25
- package/src/Accordion/AccordionContent.torp +18 -12
- package/src/Accordion/AccordionHeader.torp +15 -8
- package/src/Accordion/AccordionItem.torp +34 -17
- package/src/Accordion/AccordionTrigger.torp +17 -10
- package/src/Accordion/AccordionTypes.ts +6 -3
- package/src/Breadcrumb/Breadcrumb.torp +18 -10
- package/src/Breadcrumb/BreadcrumbItem.torp +14 -7
- package/src/Breadcrumb/BreadcrumbSeparator.torp +10 -3
- package/src/Calendar/Calendar.torp +21 -14
- package/src/Calendar/CalendarDay.torp +12 -4
- package/src/Contextual/Contextual.torp +125 -0
- package/src/{Popover/PopoverContentContextual.torp → Contextual/ContextualContent.torp} +21 -12
- package/src/Contextual/ContextualTrigger.torp +66 -0
- package/src/Contextual/ContextualTypes.ts +30 -0
- package/src/Contextual/index.ts +5 -0
- package/src/Dialog/Dialog.torp +49 -73
- package/src/Dialog/DialogBody.torp +15 -9
- package/src/Dialog/DialogButton.torp +27 -13
- package/src/Dialog/DialogFooter.torp +11 -3
- package/src/Dialog/DialogHeader.torp +15 -8
- package/src/Dialog/DialogTypes.ts +3 -2
- package/src/Disclosure/Disclosure.torp +34 -25
- package/src/Disclosure/DisclosureContent.torp +18 -12
- package/src/Disclosure/DisclosureHeader.torp +16 -9
- package/src/Disclosure/DisclosureTrigger.torp +15 -8
- package/src/Disclosure/DisclosureTypes.ts +0 -1
- package/src/Drawer/Drawer.torp +109 -68
- package/src/Drawer/DrawerContent.torp +80 -0
- package/src/Drawer/DrawerOverlay.torp +38 -0
- package/src/Drawer/DrawerTrigger.torp +35 -0
- package/src/Drawer/DrawerTypes.ts +24 -0
- package/src/Drawer/index.ts +4 -1
- package/src/Form/Field.torp +91 -0
- package/src/Form/Form.torp +129 -0
- package/src/Form/FormTypes.ts +30 -0
- package/src/Form/Input.torp +97 -0
- package/src/Form/Label.torp +31 -0
- package/src/Form/Message.torp +35 -0
- package/src/Form/StandardSchemaV1.ts +70 -0
- package/src/Form/index.ts +7 -0
- package/src/Menu/Menu.torp +25 -15
- package/src/Menu/MenuButton.torp +30 -13
- package/src/Menu/MenuCheck.torp +29 -14
- package/src/Menu/MenuGroup.torp +14 -6
- package/src/Menu/MenuIndicator.torp +14 -7
- package/src/Menu/MenuPopout.torp +23 -15
- package/src/Menu/MenuPopoutContent.torp +17 -10
- package/src/Menu/MenuPopoutTrigger.torp +23 -16
- package/src/Menu/MenuRadio.torp +27 -16
- package/src/Menu/MenuRadioGroup.torp +34 -15
- package/src/Menu/MenuSeparator.torp +11 -3
- package/src/Menu/MenuTypes.ts +7 -5
- package/src/MenuBar/MenuBar.torp +24 -16
- package/src/MenuBar/MenuBarItem.torp +24 -16
- package/src/MenuBar/MenuBarItemContent.torp +18 -11
- package/src/MenuBar/MenuBarItemTrigger.torp +15 -9
- package/src/Modal/Modal.torp +118 -0
- package/src/Modal/ModalContent.torp +77 -0
- package/src/Modal/ModalOverlay.torp +38 -0
- package/src/Modal/ModalTrigger.torp +50 -0
- package/src/Modal/ModalTypes.ts +22 -0
- package/src/Modal/index.ts +10 -0
- package/src/Modal/showModal.ts +19 -0
- package/src/Modal/showPrompt.ts +23 -0
- package/src/NavMenu/NavMenu.torp +18 -10
- package/src/NavMenu/NavMenuButton.torp +15 -10
- package/src/NavMenu/NavMenuElement.torp +19 -11
- package/src/NavMenu/NavMenuGroup.torp +13 -6
- package/src/NavMenu/NavMenuGroupHeader.torp +15 -8
- package/src/NavMenu/NavMenuLink.torp +21 -16
- package/src/NavMenu/NavMenuPopout.torp +34 -18
- package/src/NavMenu/NavMenuPopoutButton.torp +23 -18
- package/src/NavMenu/NavMenuPopoutContent.torp +23 -13
- package/src/NavMenu/NavMenuSeparator.torp +10 -3
- package/src/Notification/Notification.torp +35 -16
- package/src/Notification/NotificationClose.torp +10 -3
- package/src/Notification/NotificationContainer.torp +11 -3
- package/src/Notification/NotificationContent.torp +11 -3
- package/src/Popover/Popover.torp +48 -28
- package/src/Popover/PopoverContent.torp +42 -8
- package/src/Popover/PopoverTrigger.torp +32 -3
- package/src/Popover/PopoverTypes.ts +1 -1
- package/src/Popover/index.ts +1 -24
- package/src/Slider/Slider.torp +3 -3
- package/src/TabGroup/TabContent.torp +20 -11
- package/src/TabGroup/TabGroup.torp +58 -40
- package/src/TabGroup/TabGroupTypes.ts +10 -5
- package/src/TabGroup/TabHeader.torp +26 -10
- package/src/TabGroup/TabList.torp +14 -7
- package/src/TabGroup/TabTrigger.torp +17 -10
- package/src/icons/ArrowDown.torp +5 -3
- package/src/icons/ArrowLeft.torp +5 -3
- package/src/icons/ArrowRight.torp +5 -3
- package/src/icons/ArrowUp.torp +5 -3
- package/src/icons/Bars.torp +5 -3
- package/src/icons/Check.torp +5 -3
- package/src/icons/ChevronDown.torp +5 -3
- package/src/icons/ChevronLeft.torp +5 -3
- package/src/icons/ChevronRight.torp +5 -3
- package/src/icons/ChevronUp.torp +5 -3
- package/src/icons/Cross.torp +5 -3
- package/src/icons/IconTypes.ts +6 -0
- package/src/icons/Loading.torp +5 -3
- package/src/icons/Minus.torp +5 -3
- package/src/icons/Plus.torp +5 -3
- package/src/motion/fade.ts +15 -6
- package/src/motion/grow.ts +23 -0
- package/src/motion/index.ts +4 -1
- package/src/motion/measure.ts +28 -0
- package/src/motion/slide.ts +45 -0
- package/src/mount/clickPopover.ts +51 -0
- package/src/mount/contextPopover.ts +51 -0
- package/src/mount/hoverPopover.ts +58 -0
- package/test/Accordion/components/AccordionAccessibility.torp +1 -1
- package/test/Accordion/components/AccordionKeyboard.torp +1 -1
- package/test/Accordion/components/AccordionList.torp +1 -1
- package/test/Accordion/components/AccordionMultiple.torp +2 -2
- package/test/Accordion/components/AccordionSingle.torp +2 -2
- package/test/Dialog/accessibility-modal.test.ts +2 -2
- package/test/Dialog/components/DialogAccessibility.torp +8 -14
- package/test/Dialog/components/DialogFunction.torp +20 -4
- package/test/Dialog/components/DialogModal.torp +30 -0
- package/test/Dialog/components/DialogVariable.torp +7 -7
- package/test/Disclosure/accessibility.test.ts +3 -2
- package/test/Disclosure/components/DisclosureTest.torp +1 -1
- package/test/Disclosure/toggle.test.ts +3 -2
- package/test/Form/components/FieldTest.torp +25 -0
- package/test/Form/components/FormTest.torp +31 -0
- package/test/Form/components/InputTest.torp +9 -0
- package/test/Form/field.test.ts +34 -0
- package/test/Form/form.test.ts +34 -0
- package/test/Form/input.test.ts +19 -0
- package/test/Menu/accessibility.test.ts +3 -2
- package/test/Menu/basic.test.ts +11 -10
- package/test/Menu/components/MenuAccessibility.torp +5 -5
- package/test/Menu/components/MenuBasic.torp +5 -5
- package/test/MenuBar/accessibility.test.ts +3 -2
- package/test/MenuBar/basic.test.ts +3 -2
- package/test/NavMenu/basic.test.ts +1 -1
- package/test/NavMenu/components/{NavMenu.torp → NavMenuBasic.torp} +1 -1
- package/test/Notification/components/NotificationFunction.torp +0 -3
- package/test/Notification/components/NotificationVariable.torp +1 -1
- package/test/Popover/components/PopoverFunction.torp +37 -0
- package/test/Popover/components/PopoverTrigger.torp +36 -0
- package/test/Popover/components/{PromptVariable.torp → PopoverVariable.torp} +5 -3
- package/test/Popover/function.test.ts +2 -7
- package/test/Popover/trigger.test.ts +27 -0
- package/test/Popover/variable.test.ts +2 -2
- package/test/TabGroup/components/TabGroupAccessibility.torp +1 -1
- package/test/TabGroup/components/TabGroupKeyboard.torp +1 -1
- package/test/TabGroup/components/TabGroupList.torp +1 -1
- package/test/TabGroup/components/TabGroupTrigger.torp +1 -1
- package/tsup.config.ts +3 -1
- package/dist/Popover/PopoverContentAnchored.torp +0 -106
- package/dist/Popover/PopoverOverlay.torp +0 -30
- package/dist/Popover/PopoverTriggerContextual.torp +0 -37
- package/dist/Popover/PopoverTriggerHover.torp +0 -38
- package/dist/Popover/mountClickPopover.ts +0 -50
- package/dist/Popover/mountContextPopover.ts +0 -50
- package/dist/Popover/mountHoverPopover.ts +0 -57
- package/dist/Popover/showPopoverPrompt.ts +0 -23
- package/src/Popover/PopoverContentAnchored.torp +0 -106
- package/src/Popover/PopoverOverlay.torp +0 -30
- package/src/Popover/PopoverTriggerContextual.torp +0 -37
- package/src/Popover/PopoverTriggerHover.torp +0 -38
- package/src/Popover/mountClickPopover.ts +0 -50
- package/src/Popover/mountContextPopover.ts +0 -50
- package/src/Popover/mountHoverPopover.ts +0 -57
- package/src/Popover/showPopoverPrompt.ts +0 -23
- package/test/Dialog/components/CustomDialog.torp +0 -20
- package/test/Popover/components/PromptFunction.torp +0 -19
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type SlotRender } from "@torpor/view";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
interface ContextualProps {
|
|
5
|
+
/** An ID for the root element */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Class name(s) for the root element */
|
|
8
|
+
class?: string,
|
|
9
|
+
/** Whether the contextual is modal. If true, an overlay should be supplied to obscure outside content, and only the context content will be visible to screen readers */
|
|
10
|
+
modal?: boolean,
|
|
11
|
+
/** Whether the contextual is visible */
|
|
12
|
+
visible?: boolean,
|
|
13
|
+
/** The element to anchor this contextual to, as an alternative to supplying a ContextualTrigger */
|
|
14
|
+
anchor?: HTMLElement,
|
|
15
|
+
/** The position to display this contextual at */
|
|
16
|
+
position?: Point,
|
|
17
|
+
/** A function to be called when the user selects a response */
|
|
18
|
+
callback?: ((value: any) => void),
|
|
19
|
+
/** Raised when this contextual is opened or closed */
|
|
20
|
+
ontoggle?: (open: boolean) => void,
|
|
21
|
+
/** Raised when the contextual has opened */
|
|
22
|
+
onopen?: () => void,
|
|
23
|
+
/** Raised when the contextual has closed */
|
|
24
|
+
onclose?: (result: any) => void,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A contextual window that is shown to the user at the cursor's location.
|
|
29
|
+
*
|
|
30
|
+
* The structure of a Contextual is:
|
|
31
|
+
*
|
|
32
|
+
* ```
|
|
33
|
+
* <Contextual>
|
|
34
|
+
* <ContextualTrigger /> (optional)
|
|
35
|
+
* <ContextualContent />
|
|
36
|
+
* </Contextual>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function Contextual(
|
|
40
|
+
$parent: ParentNode,
|
|
41
|
+
$anchor: Node | null,
|
|
42
|
+
$props: ContextualProps | undefined,
|
|
43
|
+
$context?: Record<PropertyKey, any>,
|
|
44
|
+
$slots?: Record<string, SlotRender>,
|
|
45
|
+
): void;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
interface ContextualContentProps {
|
|
50
|
+
/** An ID for the root element */
|
|
51
|
+
id?: string;
|
|
52
|
+
/** Class name(s) for the root element */
|
|
53
|
+
class?: string,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The content that is displayed for a Contextual when it is open, displayed at the
|
|
58
|
+
* position that the user right-clicked.
|
|
59
|
+
*/
|
|
60
|
+
declare function ContextualContent(
|
|
61
|
+
$parent: ParentNode,
|
|
62
|
+
$anchor: Node | null,
|
|
63
|
+
$props: ContextualContentProps | undefined,
|
|
64
|
+
$context?: Record<PropertyKey, any>,
|
|
65
|
+
$slots?: Record<string, SlotRender>,
|
|
66
|
+
): void;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
interface ContextualTriggerProps {
|
|
71
|
+
/** An ID for the root element */
|
|
72
|
+
id?: string;
|
|
73
|
+
/** Class name(s) for the root element */
|
|
74
|
+
class?: string,
|
|
75
|
+
/** Whether the popover is activated by click/press or by hover **/
|
|
76
|
+
activation?: "press" | "hover"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The element that causes a Contextual to appear or disappear when right-clicked.
|
|
81
|
+
*/
|
|
82
|
+
declare function ContextualTrigger(
|
|
83
|
+
$parent: ParentNode,
|
|
84
|
+
$anchor: Node | null,
|
|
85
|
+
$props: ContextualTriggerProps | undefined,
|
|
86
|
+
$context?: Record<PropertyKey, any>,
|
|
87
|
+
$slots?: Record<string, SlotRender>,
|
|
88
|
+
): void;
|
|
89
|
+
|
|
90
|
+
export { Contextual, ContextualContent, ContextualTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/Contextual/Contextual.torp
|
|
2
|
+
import Contextual_default from "./Contextual.torp";
|
|
3
|
+
|
|
4
|
+
// src/Contextual/ContextualContent.torp
|
|
5
|
+
import ContextualContent_default from "./ContextualContent.torp";
|
|
6
|
+
|
|
7
|
+
// src/Contextual/ContextualTrigger.torp
|
|
8
|
+
import ContextualTrigger_default from "./ContextualTrigger.torp";
|
|
9
|
+
export {
|
|
10
|
+
Contextual_default as Contextual,
|
|
11
|
+
ContextualContent_default as ContextualContent,
|
|
12
|
+
ContextualTrigger_default as ContextualTrigger
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Dialog/Dialog.torp
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import getId from "../utils/getId";
|
|
2
|
-
import { addDocumentEvent, removeDocumentEvent } from "../utils/documentEvents";
|
|
3
2
|
import { trapFocus, type TrapFocusOptions } from "../mount/trapFocus";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { ModalContextName, type ModalContext } from "../Modal/ModalTypes";
|
|
4
|
+
import { PopoverContextName } from "../Popover/PopoverTypes";
|
|
5
|
+
import { DialogContextName, type DialogContext, type DialogState, type HandleButtonPress } from "./DialogTypes";
|
|
6
|
+
|
|
7
|
+
interface DialogProps {
|
|
8
|
+
/** An ID for the root element */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Class name(s) for the root element */
|
|
11
|
+
class?: string,
|
|
12
|
+
/** An ARIA label for describing the popover to screen readers */
|
|
13
|
+
ariaLabel?: string,
|
|
14
|
+
/** Whether the dialog should alert the user via the screen reader */
|
|
15
|
+
alert?: boolean,
|
|
16
|
+
}
|
|
6
17
|
|
|
7
18
|
/**
|
|
8
|
-
*
|
|
19
|
+
* A dialog that can be used to show a message to the user, or get information from the user.
|
|
20
|
+
*
|
|
21
|
+
* Dialogs are typically shown within a Modal or Popover.
|
|
9
22
|
*
|
|
10
23
|
* See [the WAI ARIA guidelines for Dialogs](https://www.w3.org/WAI/ARIA/apg/patterns/dialogmodal/).
|
|
11
24
|
*
|
|
@@ -13,43 +26,44 @@ import { DialogContextName, type DialogContext, type DialogState } from "./Dialo
|
|
|
13
26
|
*
|
|
14
27
|
* ```
|
|
15
28
|
* <Dialog>
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
29
|
+
* <ModalOverlay /> (optional -- will set `modal` to true)
|
|
30
|
+
* <DialogHeader /> (optional)
|
|
31
|
+
* <DialogBody /> (optional)
|
|
32
|
+
* <DialogFooter> (optional)
|
|
33
|
+
* <DialogButton /> (optional)
|
|
34
|
+
* </DialogFooter>
|
|
21
35
|
* </Dialog>
|
|
22
36
|
* ```
|
|
23
37
|
*
|
|
24
|
-
* @prop {string | undefined} ariaLabel -- An ARIA label for describing the popover to screen readers
|
|
25
|
-
* @prop {boolean} alert -- Whether the dialog should alert the user via the screen reader
|
|
26
38
|
*/
|
|
27
|
-
export default function Dialog($props:
|
|
28
|
-
|
|
29
|
-
$props.dialog ??= false;
|
|
39
|
+
export default function Dialog($props: DialogProps | undefined) {
|
|
40
|
+
let defaultId = getId();
|
|
30
41
|
|
|
31
|
-
let div: HTMLDivElement;
|
|
42
|
+
//let div: HTMLDivElement;
|
|
32
43
|
|
|
33
44
|
let trapFocusOptions: TrapFocusOptions = {
|
|
34
45
|
focusableElements: []
|
|
35
46
|
};
|
|
36
47
|
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
// Maybe get stuff out of a Modal context
|
|
49
|
+
let modal = false;
|
|
50
|
+
let visible = true;
|
|
51
|
+
let handleButton: HandleButtonPress | undefined = undefined;
|
|
52
|
+
const modalContext = $context[ModalContextName] ?? $context[PopoverContextName] as ModalContext;
|
|
53
|
+
if (modalContext) {
|
|
54
|
+
modal = true;
|
|
55
|
+
visible = modalContext.state.visible;
|
|
56
|
+
handleButton = modalContext.handleButton;
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
modalContext.handleClickOutside = handleClickOutside;
|
|
59
|
+
// Set the focusFirstElement method in the ModalContext so that it can be
|
|
60
|
+
// called after everything has been shown
|
|
61
|
+
modalContext.focusFirstElement = focusFirstElement;
|
|
62
|
+
}
|
|
49
63
|
|
|
50
64
|
// Set the IDs for using in the Dialog's ARIA attributes
|
|
51
65
|
let $state: DialogState = $watch({
|
|
52
|
-
dialogId: $props
|
|
66
|
+
dialogId: $props?.id ?? defaultId,
|
|
53
67
|
headerId: "",
|
|
54
68
|
bodyId: "",
|
|
55
69
|
visible
|
|
@@ -59,60 +73,22 @@ export default function Dialog($props: any) {
|
|
|
59
73
|
let context: DialogContext = {
|
|
60
74
|
handleButton,
|
|
61
75
|
state: $state,
|
|
62
|
-
anchorElement:
|
|
76
|
+
anchorElement: modalContext ? modalContext.anchorElement : undefined
|
|
63
77
|
};
|
|
64
78
|
$context[DialogContextName] = context;
|
|
65
79
|
|
|
66
|
-
let closeOnClick = false;
|
|
67
|
-
|
|
68
|
-
$mount(() => {
|
|
69
|
-
if ($state.visible) {
|
|
70
|
-
// HACK: Because this Dialog could be shown with a click, we need to
|
|
71
|
-
// wait for another mousedown before we close on click. Otherwise
|
|
72
|
-
// the click immediately bubbles to the document. I guess we could
|
|
73
|
-
// require the user to preventDefault after calling showPrompt etc,
|
|
74
|
-
// but that seems very error-prone?
|
|
75
|
-
closeOnClick = false;
|
|
76
|
-
addDocumentEvent("mousedown", handleDocumentMouseDown);
|
|
77
|
-
addDocumentEvent("click", handleDocumentClick);
|
|
78
|
-
} else {
|
|
79
|
-
removeDocumentEvent("mousedown", handleDocumentMouseDown);
|
|
80
|
-
removeDocumentEvent("click", handleDocumentClick);
|
|
81
|
-
// Focus the anchor element per WAI guidelines
|
|
82
|
-
if (context.anchorElement?.focus) {
|
|
83
|
-
context.anchorElement.focus();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
80
|
function focusFirstElement() {
|
|
89
81
|
if (trapFocusOptions.focusableElements.length) {
|
|
90
82
|
trapFocusOptions.focusableElements[0].focus();
|
|
91
83
|
}
|
|
92
84
|
}
|
|
93
85
|
|
|
94
|
-
function handleDocumentMouseDown() {
|
|
95
|
-
closeOnClick = true;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function handleDocumentClick(e: MouseEvent) {
|
|
99
|
-
if (
|
|
100
|
-
closeOnClick &&
|
|
101
|
-
div &&
|
|
102
|
-
!div.contains(e.target as HTMLElement) &&
|
|
103
|
-
(!context.anchorElement || !context.anchorElement.contains(e.target as HTMLElement))
|
|
104
|
-
) {
|
|
105
|
-
handleClickOutside(e);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
86
|
function handleClickOutside(e: MouseEvent) {
|
|
110
87
|
// Don't allow the user to click outside -- they must press a button or
|
|
111
88
|
// the Esc key
|
|
112
89
|
e.preventDefault();
|
|
113
90
|
if (!modal) {
|
|
114
|
-
|
|
115
|
-
context.state.visible = false;
|
|
91
|
+
modalContext.state.visible = false;
|
|
116
92
|
}
|
|
117
93
|
}
|
|
118
94
|
|
|
@@ -138,17 +114,17 @@ export default function Dialog($props: any) {
|
|
|
138
114
|
|
|
139
115
|
@render {
|
|
140
116
|
<div
|
|
141
|
-
{$props
|
|
142
|
-
class={`torp-dialog ${$props
|
|
117
|
+
id={$props?.id ?? defaultId}
|
|
118
|
+
class={`torp-dialog ${$props?.class ?? ""}`.trim()}
|
|
143
119
|
tabindex="0"
|
|
144
|
-
role={$props
|
|
120
|
+
role={$props?.alert === true ? "alertdialog" : "dialog"}
|
|
145
121
|
aria-modal={modal}
|
|
146
|
-
aria-label={$props
|
|
147
|
-
aria-labelledby={!$props
|
|
122
|
+
aria-label={$props?.ariaLabel}
|
|
123
|
+
aria-labelledby={!$props?.ariaLabel && $state.headerId ? $state.headerId : undefined}
|
|
148
124
|
aria-describedby={$state.bodyId ? $state.bodyId : undefined}
|
|
149
125
|
onkeydown={handleKey}
|
|
150
126
|
onmount={(el) => trapFocus(el, trapFocusOptions)}
|
|
151
|
-
|
|
127
|
+
@//&ref={div}
|
|
152
128
|
>
|
|
153
129
|
<slot />
|
|
154
130
|
</div>
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import getId from "../utils/getId";
|
|
2
2
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
3
3
|
|
|
4
|
+
interface DialogBodyProps {
|
|
5
|
+
/** An ID for the root element */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Class name(s) for the root element */
|
|
8
|
+
class?: string,
|
|
9
|
+
/** Whether the body content will be announced by screen readers when the Dialog is opened */
|
|
10
|
+
ariaAnnounce?: boolean,
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* The body information for a Dialog. Content in the body will be announced by
|
|
6
15
|
* screen readers when the Dialog is opened, unless ariaAnnounce is false.
|
|
7
|
-
*
|
|
8
|
-
* @prop {boolean} ariaAnnounce -- Whether the body content will be announced by screen readers when the Dialog is opened
|
|
9
16
|
*/
|
|
10
|
-
export default function DialogBody($props:
|
|
11
|
-
|
|
12
|
-
$props.ariaAnnounce ??= true;
|
|
17
|
+
export default function DialogBody($props: DialogBodyProps | undefined) {
|
|
18
|
+
let defaultId = getId();
|
|
13
19
|
|
|
14
20
|
// Get stuff out of the DialogContext
|
|
15
21
|
const context = $context[DialogContextName] as DialogContext;
|
|
@@ -19,14 +25,14 @@ export default function DialogBody($props: any) {
|
|
|
19
25
|
let $state = context.state;
|
|
20
26
|
|
|
21
27
|
// Set the body id for using in the Dialog's ARIA attributes
|
|
22
|
-
if ($props
|
|
23
|
-
$state.bodyId = $props
|
|
28
|
+
if ($props?.ariaAnnounce !== false) {
|
|
29
|
+
$state.bodyId = $props?.id || defaultId;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
@render {
|
|
27
33
|
<div
|
|
28
|
-
{$props
|
|
29
|
-
class={`torp-dialog-body ${$props
|
|
34
|
+
id={$props?.id ?? defaultId}
|
|
35
|
+
class={`torp-dialog-body ${$props?.class ?? ""}`.trim()}
|
|
30
36
|
>
|
|
31
37
|
<slot />
|
|
32
38
|
</div>
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
2
2
|
|
|
3
|
+
interface DialogButtonProps {
|
|
4
|
+
/** An ID for the root element */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Class name(s) for the root element */
|
|
7
|
+
class?: string,
|
|
8
|
+
/** The value that should be returned when this button is pressed and the Dialog was invoked by calling showContextual, showPrompt or showPopover */
|
|
9
|
+
value?: any,
|
|
10
|
+
/** "confirm" if the button should respond to the Enter key or "cancel" if the button should respond to the Escape key */
|
|
11
|
+
type?: "confirm" | "cancel",
|
|
12
|
+
/** Whether this button is disabled */
|
|
13
|
+
disabled?: boolean,
|
|
14
|
+
/** Raised when the button is clicked */
|
|
15
|
+
onclick?: (e: MouseEvent) => void,
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
/**
|
|
4
19
|
* A button that is placed in a DialogFooter and signals a response by a user.
|
|
5
20
|
*
|
|
6
|
-
* @prop {any | undefined} value -- The value that should be returned when this button is pressed and the Dialog was invoked by calling showContextual, showPrompt or showPopover
|
|
7
|
-
* @prop {"confirm" | "cancel" | undefined} type -- "confirm" if the button should respond to the Enter key or "cancel" if the button should respond to the Escape key
|
|
8
|
-
* @prop {boolean} disabled -- Whether this button is disabled
|
|
9
21
|
*/
|
|
10
|
-
export default function DialogButton($props:
|
|
22
|
+
export default function DialogButton($props: DialogButtonProps | undefined) {
|
|
11
23
|
let button: HTMLButtonElement;
|
|
12
24
|
|
|
13
25
|
// Get stuff out of the DialogContext
|
|
@@ -19,26 +31,28 @@ export default function DialogButton($props: any) {
|
|
|
19
31
|
|
|
20
32
|
$mount(() => {
|
|
21
33
|
// Store the confirm or cancel button in the DialogContext
|
|
22
|
-
if ($props
|
|
34
|
+
if ($props?.type === "confirm") {
|
|
23
35
|
context.confirmButton = button;
|
|
24
|
-
} else if ($props
|
|
36
|
+
} else if ($props?.type === "cancel") {
|
|
25
37
|
context.cancelButton = button;
|
|
26
38
|
}
|
|
27
39
|
});
|
|
28
40
|
|
|
29
|
-
function handleClick(e) {
|
|
30
|
-
if ($props
|
|
31
|
-
$props
|
|
41
|
+
function handleClick(e: MouseEvent) {
|
|
42
|
+
if ($props?.onclick) {
|
|
43
|
+
$props?.onclick(e)
|
|
44
|
+
}
|
|
45
|
+
if (handleButton) {
|
|
46
|
+
handleButton($props?.type, $props?.value);
|
|
32
47
|
}
|
|
33
|
-
handleButton($props.type, $props.value);
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
@render {
|
|
37
51
|
<button
|
|
38
52
|
type="button"
|
|
39
|
-
{$props
|
|
40
|
-
class={`torp-dialog-button ${$props
|
|
41
|
-
disabled={$props
|
|
53
|
+
{$props?.id}
|
|
54
|
+
class={`torp-dialog-button ${$props?.class ?? ""}`.trim()}
|
|
55
|
+
disabled={$props?.disabled}
|
|
42
56
|
onclick={handleClick}
|
|
43
57
|
&ref={button}
|
|
44
58
|
>
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
interface DialogFooterProps {
|
|
3
|
+
/** An ID for the root element */
|
|
4
|
+
id?: string;
|
|
5
|
+
/** Class name(s) for the root element */
|
|
6
|
+
class?: string,
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* The footer for a Dialog, which may contain one or more DialogButtons.
|
|
3
11
|
*/
|
|
4
|
-
export default function DialogFooter($props:
|
|
12
|
+
export default function DialogFooter($props: DialogFooterProps | undefined) {
|
|
5
13
|
@render {
|
|
6
14
|
<div
|
|
7
|
-
{$props
|
|
8
|
-
class={`torp-dialog-footer ${$props
|
|
15
|
+
{$props?.id}
|
|
16
|
+
class={`torp-dialog-footer ${$props?.class ?? ""}`.trim()}
|
|
9
17
|
>
|
|
10
18
|
<slot />
|
|
11
19
|
</div>
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import getId from "../utils/getId";
|
|
2
2
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
3
3
|
|
|
4
|
+
interface DialogHeaderProps {
|
|
5
|
+
/** An ID for the root element */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Class name(s) for the root element */
|
|
8
|
+
class?: string,
|
|
9
|
+
/** Whether the header will be announced by screen readers when the Dialog is opened */
|
|
10
|
+
ariaAnnounce?: boolean,
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
14
|
* The header for a Dialog. Content in the header will be announced by screen
|
|
6
15
|
* readers when the Dialog is opened, unless ariaAnnounce is false.
|
|
7
16
|
*
|
|
8
|
-
* @prop {boolean} ariaAnnounce -- Whether the header will be announced by screen readers when the Dialog is opened
|
|
9
17
|
*/
|
|
10
|
-
export default function DialogHeader($props:
|
|
11
|
-
|
|
12
|
-
$props.ariaAnnounce ??= true;
|
|
18
|
+
export default function DialogHeader($props: DialogHeaderProps | undefined) {
|
|
19
|
+
let defaultId = getId();
|
|
13
20
|
|
|
14
21
|
// Get stuff out of the DialogContext
|
|
15
22
|
const context = $context[DialogContextName] as DialogContext;
|
|
@@ -19,14 +26,14 @@ export default function DialogHeader($props: any) {
|
|
|
19
26
|
let $state = context.state;
|
|
20
27
|
|
|
21
28
|
// Set the header id for using in the Dialog's ARIA attributes
|
|
22
|
-
if ($props
|
|
23
|
-
$state.headerId = $props
|
|
29
|
+
if ($props?.ariaAnnounce !== false) {
|
|
30
|
+
$state.headerId = $props?.id ?? defaultId;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
@render {
|
|
27
34
|
<div
|
|
28
|
-
{$props
|
|
29
|
-
class={`torp-dialog-footer ${$props
|
|
35
|
+
id={$props?.id ?? defaultId}
|
|
36
|
+
class={`torp-dialog-footer ${$props?.class ?? ""}`.trim()}
|
|
30
37
|
>
|
|
31
38
|
<slot />
|
|
32
39
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export const DialogContextName = "Dialog";
|
|
2
2
|
|
|
3
|
+
export type HandleButtonPress = (type: "confirm" | "cancel" | undefined, value?: any) => void;
|
|
4
|
+
|
|
3
5
|
export interface DialogContext {
|
|
4
|
-
handleButton
|
|
6
|
+
handleButton?: HandleButtonPress;
|
|
5
7
|
state: DialogState;
|
|
6
8
|
anchorElement?: HTMLElement;
|
|
7
9
|
confirmButton?: HTMLButtonElement;
|
|
@@ -12,5 +14,4 @@ export interface DialogState {
|
|
|
12
14
|
dialogId: string;
|
|
13
15
|
headerId: string;
|
|
14
16
|
bodyId: string;
|
|
15
|
-
visible: boolean;
|
|
16
17
|
}
|
package/dist/Dialog/index.d.ts
CHANGED
|
@@ -1,90 +1,138 @@
|
|
|
1
1
|
import { type SlotRender } from "@torpor/view";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
interface DialogProps {
|
|
5
|
+
/** An ID for the root element */
|
|
6
|
+
id?: string;
|
|
7
|
+
/** Class name(s) for the root element */
|
|
8
|
+
class?: string,
|
|
9
|
+
/** An ARIA label for describing the popover to screen readers */
|
|
10
|
+
ariaLabel?: string,
|
|
11
|
+
/** Whether the dialog should alert the user via the screen reader */
|
|
12
|
+
alert?: boolean,
|
|
13
|
+
}
|
|
14
|
+
|
|
4
15
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
16
|
+
* A dialog that can be used to show a message to the user, or get information from the user.
|
|
17
|
+
*
|
|
18
|
+
* Dialogs are typically shown within a Modal or Popover.
|
|
19
|
+
*
|
|
20
|
+
* See [the WAI ARIA guidelines for Dialogs](https://www.w3.org/WAI/ARIA/apg/patterns/dialogmodal/).
|
|
21
|
+
*
|
|
22
|
+
* The structure of a Dialog is:
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
* <Dialog>
|
|
26
|
+
* <ModalOverlay /> (optional -- will set `modal` to true)
|
|
27
|
+
* <DialogHeader /> (optional)
|
|
28
|
+
* <DialogBody /> (optional)
|
|
29
|
+
* <DialogFooter> (optional)
|
|
30
|
+
* <DialogButton /> (optional)
|
|
31
|
+
* </DialogFooter>
|
|
32
|
+
* </Dialog>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
11
35
|
*/
|
|
12
36
|
declare function Dialog(
|
|
13
37
|
$parent: ParentNode,
|
|
14
38
|
$anchor: Node | null,
|
|
15
|
-
$props:
|
|
39
|
+
$props: DialogProps | undefined,
|
|
16
40
|
$context?: Record<PropertyKey, any>,
|
|
17
41
|
$slots?: Record<string, SlotRender>,
|
|
18
42
|
): void;
|
|
19
43
|
|
|
20
44
|
|
|
21
45
|
|
|
46
|
+
interface DialogBodyProps {
|
|
47
|
+
/** An ID for the root element */
|
|
48
|
+
id?: string;
|
|
49
|
+
/** Class name(s) for the root element */
|
|
50
|
+
class?: string,
|
|
51
|
+
/** Whether the body content will be announced by screen readers when the Dialog is opened */
|
|
52
|
+
ariaAnnounce?: boolean,
|
|
53
|
+
}
|
|
54
|
+
|
|
22
55
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param $anchor -- The node to mount the component before.
|
|
26
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
27
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
28
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
56
|
+
* The body information for a Dialog. Content in the body will be announced by
|
|
57
|
+
* screen readers when the Dialog is opened, unless ariaAnnounce is false.
|
|
29
58
|
*/
|
|
30
59
|
declare function DialogBody(
|
|
31
60
|
$parent: ParentNode,
|
|
32
61
|
$anchor: Node | null,
|
|
33
|
-
$props:
|
|
62
|
+
$props: DialogBodyProps | undefined,
|
|
34
63
|
$context?: Record<PropertyKey, any>,
|
|
35
64
|
$slots?: Record<string, SlotRender>,
|
|
36
65
|
): void;
|
|
37
66
|
|
|
38
67
|
|
|
39
68
|
|
|
69
|
+
interface DialogButtonProps {
|
|
70
|
+
/** An ID for the root element */
|
|
71
|
+
id?: string;
|
|
72
|
+
/** Class name(s) for the root element */
|
|
73
|
+
class?: string,
|
|
74
|
+
/** The value that should be returned when this button is pressed and the Dialog was invoked by calling showContextual, showPrompt or showPopover */
|
|
75
|
+
value?: any,
|
|
76
|
+
/** "confirm" if the button should respond to the Enter key or "cancel" if the button should respond to the Escape key */
|
|
77
|
+
type?: "confirm" | "cancel",
|
|
78
|
+
/** Whether this button is disabled */
|
|
79
|
+
disabled?: boolean,
|
|
80
|
+
/** Raised when the button is clicked */
|
|
81
|
+
onclick?: (e: MouseEvent) => void,
|
|
82
|
+
}
|
|
83
|
+
|
|
40
84
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @param $anchor -- The node to mount the component before.
|
|
44
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
45
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
46
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
85
|
+
* A button that is placed in a DialogFooter and signals a response by a user.
|
|
86
|
+
*
|
|
47
87
|
*/
|
|
48
88
|
declare function DialogButton(
|
|
49
89
|
$parent: ParentNode,
|
|
50
90
|
$anchor: Node | null,
|
|
51
|
-
$props:
|
|
91
|
+
$props: DialogButtonProps | undefined,
|
|
52
92
|
$context?: Record<PropertyKey, any>,
|
|
53
93
|
$slots?: Record<string, SlotRender>,
|
|
54
94
|
): void;
|
|
55
95
|
|
|
56
96
|
|
|
57
97
|
|
|
98
|
+
interface DialogFooterProps {
|
|
99
|
+
/** An ID for the root element */
|
|
100
|
+
id?: string;
|
|
101
|
+
/** Class name(s) for the root element */
|
|
102
|
+
class?: string,
|
|
103
|
+
}
|
|
104
|
+
|
|
58
105
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @param $parent -- The parent node.
|
|
61
|
-
* @param $anchor -- The node to mount the component before.
|
|
62
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
63
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
64
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
106
|
+
* The footer for a Dialog, which may contain one or more DialogButtons.
|
|
65
107
|
*/
|
|
66
108
|
declare function DialogFooter(
|
|
67
109
|
$parent: ParentNode,
|
|
68
110
|
$anchor: Node | null,
|
|
69
|
-
$props:
|
|
111
|
+
$props: DialogFooterProps | undefined,
|
|
70
112
|
$context?: Record<PropertyKey, any>,
|
|
71
113
|
$slots?: Record<string, SlotRender>,
|
|
72
114
|
): void;
|
|
73
115
|
|
|
74
116
|
|
|
75
117
|
|
|
118
|
+
interface DialogHeaderProps {
|
|
119
|
+
/** An ID for the root element */
|
|
120
|
+
id?: string;
|
|
121
|
+
/** Class name(s) for the root element */
|
|
122
|
+
class?: string,
|
|
123
|
+
/** Whether the header will be announced by screen readers when the Dialog is opened */
|
|
124
|
+
ariaAnnounce?: boolean,
|
|
125
|
+
}
|
|
126
|
+
|
|
76
127
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
81
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
82
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
128
|
+
* The header for a Dialog. Content in the header will be announced by screen
|
|
129
|
+
* readers when the Dialog is opened, unless ariaAnnounce is false.
|
|
130
|
+
*
|
|
83
131
|
*/
|
|
84
132
|
declare function DialogHeader(
|
|
85
133
|
$parent: ParentNode,
|
|
86
134
|
$anchor: Node | null,
|
|
87
|
-
$props:
|
|
135
|
+
$props: DialogHeaderProps | undefined,
|
|
88
136
|
$context?: Record<PropertyKey, any>,
|
|
89
137
|
$slots?: Record<string, SlotRender>,
|
|
90
138
|
): void;
|