@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
|
@@ -5,15 +5,22 @@ import {
|
|
|
5
5
|
type MenuPopoutContext
|
|
6
6
|
} from "./MenuTypes";
|
|
7
7
|
|
|
8
|
+
interface MenuPopoutTriggerProps {
|
|
9
|
+
/** An ID for the root element */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** Class name(s) for the root element */
|
|
12
|
+
class?: string,
|
|
13
|
+
/** The delay before showing the popout, in milliseconds */
|
|
14
|
+
hoverDelay?: number,
|
|
15
|
+
/** Whether this button is disabled */
|
|
16
|
+
disabled?: boolean,
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
/**
|
|
9
20
|
* A button that is placed in a Menu or MenuGroup and signals a response by a user.
|
|
10
|
-
*
|
|
11
|
-
* @prop {number} hoverDelay -- The delay before showing the popout, in milliseconds
|
|
12
|
-
* @prop {boolean} disabled -- Whether this button is disabled
|
|
13
21
|
*/
|
|
14
|
-
export default function MenuPopoutTrigger() {
|
|
15
|
-
|
|
16
|
-
$props.disabled ??= false;
|
|
22
|
+
export default function MenuPopoutTrigger($props: MenuPopoutTriggerProps | undefined) {
|
|
23
|
+
let defaultHoverDelay = 500;
|
|
17
24
|
|
|
18
25
|
let button: HTMLButtonElement;
|
|
19
26
|
let interval: NodeJS.Timeout | undefined;
|
|
@@ -63,16 +70,16 @@ export default function MenuPopoutTrigger() {
|
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
function handleMouseEnter() {
|
|
66
|
-
if ($props
|
|
73
|
+
if ($props?.disabled) return;
|
|
67
74
|
|
|
68
75
|
// Handle the hover after a delay
|
|
69
76
|
if (!interval) {
|
|
70
|
-
interval = setTimeout(() => setVisible(true), $props
|
|
77
|
+
interval = setTimeout(() => setVisible(true), $props?.hoverDelay ?? defaultHoverDelay);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
function handleMouseLeave() {
|
|
75
|
-
if ($props
|
|
82
|
+
if ($props?.disabled) return;
|
|
76
83
|
|
|
77
84
|
// Prevent short hovers or touches from firing the event
|
|
78
85
|
if (interval) {
|
|
@@ -82,26 +89,26 @@ export default function MenuPopoutTrigger() {
|
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
function handleMouseMove() {
|
|
85
|
-
if ($props
|
|
92
|
+
if ($props?.disabled) return;
|
|
86
93
|
|
|
87
94
|
// Reset the interval on mouse move
|
|
88
95
|
if (interval) {
|
|
89
96
|
clearTimeout(interval);
|
|
90
|
-
interval = setTimeout(() => setVisible(true), $props
|
|
97
|
+
interval = setTimeout(() => setVisible(true), $props?.hoverDelay ?? defaultHoverDelay);
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
@render {
|
|
95
102
|
<button
|
|
96
|
-
{$props
|
|
97
|
-
class={`torp-menu-popout-trigger ${$props
|
|
103
|
+
{$props?.id}
|
|
104
|
+
class={`torp-menu-popout-trigger ${$props?.class ?? ""}`.trim()}
|
|
98
105
|
type="button"
|
|
99
|
-
{$props
|
|
106
|
+
{$props?.disabled}
|
|
100
107
|
role="menuitem"
|
|
101
108
|
aria-haspopup="true"
|
|
102
109
|
aria-expanded={($state.visible ?? false).toString()}
|
|
103
|
-
aria-disabled={$props
|
|
104
|
-
data-disabled={$props
|
|
110
|
+
aria-disabled={$props?.disabled ? "true" : undefined}
|
|
111
|
+
data-disabled={$props?.disabled ? "true" : undefined}
|
|
105
112
|
onkeydown={handlePopoutKey}
|
|
106
113
|
onclick={handleClick}
|
|
107
114
|
onfocus={() => handleItemFocus(index)}
|
package/dist/Menu/MenuRadio.torp
CHANGED
|
@@ -7,21 +7,32 @@ import {
|
|
|
7
7
|
type MenuRadioGroupContext
|
|
8
8
|
} from "./MenuTypes";
|
|
9
9
|
|
|
10
|
+
interface MenuRadioProps {
|
|
11
|
+
/** An ID for the root element */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Class name(s) for the root element */
|
|
14
|
+
class?: string,
|
|
15
|
+
/** The value of the item */
|
|
16
|
+
value?: string,
|
|
17
|
+
/** Whether this item is checked */
|
|
18
|
+
checked?: boolean,
|
|
19
|
+
/** Whether this item is disabled */
|
|
20
|
+
disabled?: boolean,
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
/**
|
|
11
24
|
* A button that is placed in a Menu or MenuGroup to allow the user to select
|
|
12
25
|
* from a number of options.
|
|
13
|
-
*
|
|
14
|
-
* @prop {string} value -- The value of the item
|
|
15
|
-
* @prop {boolean} checked -- Whether this item is checked
|
|
16
|
-
* @prop {boolean} disabled -- Whether this item is disabled
|
|
17
26
|
*/
|
|
18
|
-
export default function MenuRadio() {
|
|
27
|
+
export default function MenuRadio($props: MenuRadioProps | undefined) {
|
|
19
28
|
let $state = $watch({
|
|
20
|
-
checked: $props
|
|
29
|
+
checked: $props?.checked ?? false,
|
|
21
30
|
});
|
|
22
31
|
|
|
23
32
|
$run(() => {
|
|
24
|
-
$props
|
|
33
|
+
if ($props !== undefined) {
|
|
34
|
+
$props.checked = $state.checked;
|
|
35
|
+
}
|
|
25
36
|
});
|
|
26
37
|
|
|
27
38
|
let button: HTMLButtonElement;
|
|
@@ -44,7 +55,7 @@ export default function MenuRadio() {
|
|
|
44
55
|
const { index } = registerItem(setFocused);
|
|
45
56
|
|
|
46
57
|
// Register this item with the parent MenuRadioGroup
|
|
47
|
-
registerItemInGroup($props
|
|
58
|
+
registerItemInGroup($props?.value ?? "", setChecked);
|
|
48
59
|
|
|
49
60
|
// Set the context to pass down to items
|
|
50
61
|
let context: MenuButtonContext = {
|
|
@@ -62,21 +73,21 @@ export default function MenuRadio() {
|
|
|
62
73
|
|
|
63
74
|
function handleClick() {
|
|
64
75
|
if (!$state.checked) {
|
|
65
|
-
toggleItem($props
|
|
76
|
+
toggleItem($props?.value ?? "");
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
@render {
|
|
70
81
|
<button
|
|
71
|
-
{$props
|
|
72
|
-
class={`torp-menu-radio ${$props
|
|
82
|
+
{$props?.id}
|
|
83
|
+
class={`torp-menu-radio ${$props?.class ?? ""}`.trim()}
|
|
73
84
|
type="button"
|
|
74
|
-
{$props
|
|
85
|
+
{$props?.disabled}
|
|
75
86
|
role="menuitemradio"
|
|
76
|
-
aria-checked={$props
|
|
77
|
-
aria-disabled={$props
|
|
78
|
-
data-state={$props
|
|
79
|
-
data-disabled={$props
|
|
87
|
+
aria-checked={$props?.checked}
|
|
88
|
+
aria-disabled={$props?.disabled ? "true" : undefined}
|
|
89
|
+
data-state={$props?.checked ? "checked" : "unchecked"}
|
|
90
|
+
data-disabled={$props?.disabled ? "true" : undefined}
|
|
80
91
|
onkeydown={handleItemKey}
|
|
81
92
|
onclick={handleClick}
|
|
82
93
|
onfocus={() => handleItemFocus(index)}
|
|
@@ -4,17 +4,36 @@ import {
|
|
|
4
4
|
type RadioGroupItemState
|
|
5
5
|
} from "./MenuTypes";
|
|
6
6
|
|
|
7
|
+
interface MenuRadioGroupProps {
|
|
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 menu to screen readers */
|
|
13
|
+
ariaLabel?: string,
|
|
14
|
+
/** The value of the checked MenuRadio */
|
|
15
|
+
value?: string | undefined,
|
|
16
|
+
/** Raised when the checked item has changed */
|
|
17
|
+
onchange?: (value: any) => void,
|
|
18
|
+
}
|
|
19
|
+
|
|
7
20
|
/**
|
|
8
21
|
* A container for a logical group of menu RadioGroup items.
|
|
9
|
-
*
|
|
10
|
-
* @prop {string} ariaLabel -- An ARIA label for describing the menu to screen readers
|
|
11
|
-
* @prop {string | undefined} value -- The value of the checked MenuRadio
|
|
12
|
-
* @prop {(any) => void} onchange - Called when the checked item has changed
|
|
13
22
|
*/
|
|
14
|
-
export default function MenuRadioGroup() {
|
|
23
|
+
export default function MenuRadioGroup($props: MenuRadioGroupProps | undefined) {
|
|
15
24
|
// A collection containing the state and some functions for each item
|
|
16
25
|
let itemStates: RadioGroupItemState[] = [];
|
|
17
26
|
|
|
27
|
+
let $state = $watch({
|
|
28
|
+
value: $props?.value
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
$run(() => {
|
|
32
|
+
if ($props !== undefined) {
|
|
33
|
+
$props.value = $state.value;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
18
37
|
// Set the context to pass down to items
|
|
19
38
|
let context: MenuRadioGroupContext = {
|
|
20
39
|
registerItemInGroup,
|
|
@@ -24,11 +43,11 @@ export default function MenuRadioGroup() {
|
|
|
24
43
|
|
|
25
44
|
$mount(() => {
|
|
26
45
|
// Set the initial checked item
|
|
27
|
-
setValue($props
|
|
46
|
+
setValue($props?.value);
|
|
28
47
|
});
|
|
29
48
|
|
|
30
49
|
function registerItemInGroup(itemValue: string, setChecked: (value: boolean) => void) {
|
|
31
|
-
// Add the item
|
|
50
|
+
// Add the item's state to the array
|
|
32
51
|
const newItemState: RadioGroupItemState = {
|
|
33
52
|
value: itemValue,
|
|
34
53
|
checked: false,
|
|
@@ -52,11 +71,11 @@ export default function MenuRadioGroup() {
|
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
// Set the value
|
|
55
|
-
if ($
|
|
56
|
-
$
|
|
74
|
+
if ($state.value !== newValue) {
|
|
75
|
+
$state.value = newValue;
|
|
57
76
|
|
|
58
|
-
if ($props
|
|
59
|
-
$props
|
|
77
|
+
if ($props?.onchange) {
|
|
78
|
+
$props?.onchange($props?.value);
|
|
60
79
|
}
|
|
61
80
|
}
|
|
62
81
|
}
|
|
@@ -70,15 +89,15 @@ export default function MenuRadioGroup() {
|
|
|
70
89
|
newValue = item.value;
|
|
71
90
|
}
|
|
72
91
|
}
|
|
73
|
-
$
|
|
92
|
+
$state.value = newValue;
|
|
74
93
|
}
|
|
75
94
|
|
|
76
95
|
@render {
|
|
77
96
|
<div
|
|
78
|
-
{$props
|
|
79
|
-
class={`torp-menu-radio-group ${$props
|
|
97
|
+
{$props?.id}
|
|
98
|
+
class={`torp-menu-radio-group ${$props?.class ?? ""}`.trim()}
|
|
80
99
|
role="group"
|
|
81
|
-
aria-label={$props
|
|
100
|
+
aria-label={$props?.ariaLabel}
|
|
82
101
|
>
|
|
83
102
|
<slot />
|
|
84
103
|
</div>
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
interface MenuSeparatorProps {
|
|
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
|
* An element in a menu that separates logical sets of menu items.
|
|
3
11
|
*/
|
|
4
|
-
export default function MenuSeparator() {
|
|
12
|
+
export default function MenuSeparator($props: MenuSeparatorProps | undefined) {
|
|
5
13
|
@render {
|
|
6
14
|
<div
|
|
7
|
-
{$props
|
|
8
|
-
class={`torp-menu-separator ${$props
|
|
15
|
+
{$props?.id}
|
|
16
|
+
class={`torp-menu-separator ${$props?.class ?? ""}`.trim()}
|
|
9
17
|
role="separator"
|
|
10
18
|
>
|
|
11
19
|
<slot />
|
package/dist/Menu/MenuTypes.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface MenuContext {
|
|
|
7
7
|
setVisible: (value: boolean, result?: any) => void;
|
|
8
8
|
|
|
9
9
|
/** Called from a MenuButton to close the Menu and return a result */
|
|
10
|
-
|
|
10
|
+
handleButton: (type: "confirm" | "cancel" | undefined, value?: any) => void;
|
|
11
11
|
|
|
12
12
|
/** Called from a MenuButton when its button is focused */
|
|
13
13
|
handleItemFocus: (index: number) => void;
|
|
@@ -15,10 +15,7 @@ export interface MenuContext {
|
|
|
15
15
|
/** Called from a MenuButton when a key is pressed */
|
|
16
16
|
handleItemKey: (e: KeyboardEvent) => void;
|
|
17
17
|
|
|
18
|
-
state:
|
|
19
|
-
/** Whether the Menu is visible. Writable so that it can be subscribed to by children */
|
|
20
|
-
visible: boolean;
|
|
21
|
-
};
|
|
18
|
+
state: MenuState;
|
|
22
19
|
|
|
23
20
|
/** The element that caused this Menu to be shown */
|
|
24
21
|
anchorElement?: HTMLElement;
|
|
@@ -27,6 +24,11 @@ export interface MenuContext {
|
|
|
27
24
|
registerItem: (setFocused: () => void) => { index: number };
|
|
28
25
|
}
|
|
29
26
|
|
|
27
|
+
export interface MenuState {
|
|
28
|
+
/** Whether the Menu is visible */
|
|
29
|
+
visible: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
30
32
|
export interface MenuButtonContext {
|
|
31
33
|
state: {
|
|
32
34
|
checked: boolean;
|
package/dist/Menu/index.d.ts
CHANGED
|
@@ -1,198 +1,297 @@
|
|
|
1
1
|
import { type SlotRender } from "@torpor/view";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
interface MenuProps {
|
|
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 menu to screen readers */
|
|
10
|
+
ariaLabel?: string,
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
14
|
+
* A list of choices for the user, such as a set of actions or functions. A
|
|
15
|
+
* menu is usually hidden until made visible by the user.
|
|
16
|
+
*
|
|
17
|
+
* See [the WAI ARIA guidelines for Menus](https://www.w3.org/WAI/ARIA/apg/patterns/menu/).
|
|
18
|
+
*
|
|
19
|
+
* The structure of a Menu is:
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* <Menu>
|
|
23
|
+
* <MenuButton />
|
|
24
|
+
* <MenuSeparator /> (optional)
|
|
25
|
+
* <MenuGroup> (optional)
|
|
26
|
+
* <MenuButton />
|
|
27
|
+
* </MenuGroup>
|
|
28
|
+
* </Menu>
|
|
29
|
+
* ```
|
|
11
30
|
*/
|
|
12
31
|
declare function Menu(
|
|
13
32
|
$parent: ParentNode,
|
|
14
33
|
$anchor: Node | null,
|
|
15
|
-
$props
|
|
34
|
+
$props: MenuProps | undefined,
|
|
16
35
|
$context?: Record<PropertyKey, any>,
|
|
17
36
|
$slots?: Record<string, SlotRender>,
|
|
18
37
|
): void;
|
|
19
38
|
|
|
20
39
|
|
|
21
40
|
|
|
41
|
+
interface MenuButtonProps {
|
|
42
|
+
/** An ID for the root element */
|
|
43
|
+
id?: string;
|
|
44
|
+
/** Class name(s) for the root element */
|
|
45
|
+
class?: string,
|
|
46
|
+
/** The value that should be returned when this button is pressed and the Dialog was invoked by calling showContextual, showPrompt or showPopover */
|
|
47
|
+
value?: any,
|
|
48
|
+
/** Whether this button is disabled */
|
|
49
|
+
disabled?: boolean,
|
|
50
|
+
/** Raised when the button is clicked */
|
|
51
|
+
onclick?: (e: MouseEvent) => void,
|
|
52
|
+
/** Raised when a key is pressed down */
|
|
53
|
+
onkeydown?: (e: KeyboardEvent) => void,
|
|
54
|
+
}
|
|
55
|
+
|
|
22
56
|
/**
|
|
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.
|
|
57
|
+
* A button that is placed in a Menu or MenuGroup and signals a response by a user.
|
|
58
|
+
*
|
|
29
59
|
*/
|
|
30
60
|
declare function MenuButton(
|
|
31
61
|
$parent: ParentNode,
|
|
32
62
|
$anchor: Node | null,
|
|
33
|
-
$props
|
|
63
|
+
$props: MenuButtonProps | undefined,
|
|
34
64
|
$context?: Record<PropertyKey, any>,
|
|
35
65
|
$slots?: Record<string, SlotRender>,
|
|
36
66
|
): void;
|
|
37
67
|
|
|
38
68
|
|
|
39
69
|
|
|
70
|
+
interface MenuCheckProps {
|
|
71
|
+
/** An ID for the root element */
|
|
72
|
+
id?: string;
|
|
73
|
+
/** Class name(s) for the root element */
|
|
74
|
+
class?: string,
|
|
75
|
+
/** Whether this item is checked */
|
|
76
|
+
checked?: boolean,
|
|
77
|
+
/** Whether this item is disabled */
|
|
78
|
+
disabled?: boolean,
|
|
79
|
+
/** Raised when the checkbox is clicked */
|
|
80
|
+
onclick?: (e: MouseEvent) => void,
|
|
81
|
+
}
|
|
82
|
+
|
|
40
83
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
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.
|
|
84
|
+
* A button that is placed in a Menu or MenuGroup to allow the user to turn an
|
|
85
|
+
* option on or off.
|
|
86
|
+
*
|
|
47
87
|
*/
|
|
48
88
|
declare function MenuCheck(
|
|
49
89
|
$parent: ParentNode,
|
|
50
90
|
$anchor: Node | null,
|
|
51
|
-
$props
|
|
91
|
+
$props: MenuCheckProps | undefined,
|
|
52
92
|
$context?: Record<PropertyKey, any>,
|
|
53
93
|
$slots?: Record<string, SlotRender>,
|
|
54
94
|
): void;
|
|
55
95
|
|
|
56
96
|
|
|
57
97
|
|
|
98
|
+
interface MenuGroupProps {
|
|
99
|
+
/** An ID for the root element */
|
|
100
|
+
id?: string;
|
|
101
|
+
/** Class name(s) for the root element */
|
|
102
|
+
class?: string,
|
|
103
|
+
/** An ARIA label for describing the group to screen readers */
|
|
104
|
+
ariaLabel?: string,
|
|
105
|
+
}
|
|
106
|
+
|
|
58
107
|
/**
|
|
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.
|
|
108
|
+
* A container for a logical group of menu items.
|
|
65
109
|
*/
|
|
66
110
|
declare function MenuGroup(
|
|
67
111
|
$parent: ParentNode,
|
|
68
112
|
$anchor: Node | null,
|
|
69
|
-
$props
|
|
113
|
+
$props: MenuGroupProps | undefined,
|
|
70
114
|
$context?: Record<PropertyKey, any>,
|
|
71
115
|
$slots?: Record<string, SlotRender>,
|
|
72
116
|
): void;
|
|
73
117
|
|
|
74
118
|
|
|
75
119
|
|
|
120
|
+
interface MenuIndicatorProps {
|
|
121
|
+
/** An ID for the root element */
|
|
122
|
+
id?: string;
|
|
123
|
+
/** Class name(s) for the root element */
|
|
124
|
+
class?: string,
|
|
125
|
+
/** Whether this item is disabled */
|
|
126
|
+
disabled?: boolean,
|
|
127
|
+
}
|
|
128
|
+
|
|
76
129
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @param $anchor -- The node to mount the component before.
|
|
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.
|
|
130
|
+
* An indicator for a MenuCheck or MenuRadio component, which is displayed
|
|
131
|
+
* when the value of checked is true.
|
|
83
132
|
*/
|
|
84
133
|
declare function MenuIndicator(
|
|
85
134
|
$parent: ParentNode,
|
|
86
135
|
$anchor: Node | null,
|
|
87
|
-
$props
|
|
136
|
+
$props: MenuIndicatorProps | undefined,
|
|
88
137
|
$context?: Record<PropertyKey, any>,
|
|
89
138
|
$slots?: Record<string, SlotRender>,
|
|
90
139
|
): void;
|
|
91
140
|
|
|
92
141
|
|
|
93
142
|
|
|
143
|
+
interface MenuPopoutProps {
|
|
144
|
+
/** An ID for the root element */
|
|
145
|
+
id?: string;
|
|
146
|
+
/** Class name(s) for the root element */
|
|
147
|
+
class?: string,
|
|
148
|
+
/** Whether the popout is visible */
|
|
149
|
+
visible?: boolean,
|
|
150
|
+
/** Raised when the popout is opened or closed */
|
|
151
|
+
ontoggle?: (open: boolean) => void,
|
|
152
|
+
/** Raised when the popout has opened */
|
|
153
|
+
onopen?: () => void,
|
|
154
|
+
/** Raised when the popout has closed */
|
|
155
|
+
onclose?: (result: any) => void,
|
|
156
|
+
}
|
|
157
|
+
|
|
94
158
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
159
|
+
* A popout that is attached to a menu button and can be used to show a submenu.
|
|
160
|
+
*
|
|
161
|
+
* The structure of a MenuPopout is:
|
|
162
|
+
*
|
|
163
|
+
* ```
|
|
164
|
+
* <MenuPopout>
|
|
165
|
+
* <MenuPopoutTrigger /> (optional)
|
|
166
|
+
* <MenuPopoutContent />
|
|
167
|
+
* </MenuPopout>
|
|
168
|
+
* ```
|
|
101
169
|
*/
|
|
102
170
|
declare function MenuPopout(
|
|
103
171
|
$parent: ParentNode,
|
|
104
172
|
$anchor: Node | null,
|
|
105
|
-
$props,
|
|
173
|
+
$props: MenuPopoutProps | undefined,
|
|
106
174
|
$context?: Record<PropertyKey, any>,
|
|
107
175
|
$slots?: Record<string, SlotRender>,
|
|
108
176
|
): void;
|
|
109
177
|
|
|
110
178
|
|
|
111
179
|
|
|
180
|
+
interface MenuPopoutContentProps {
|
|
181
|
+
/** An ID for the root element */
|
|
182
|
+
id?: string;
|
|
183
|
+
/** Class name(s) for the root element */
|
|
184
|
+
class?: string,
|
|
185
|
+
/** Where the popout will be shown, relative to the popout button */
|
|
186
|
+
side?: "top" | "right" | "bottom" | "left",
|
|
187
|
+
/** How the popout will be aligned, relative to the popout button */
|
|
188
|
+
alignment?: "start" | "center" | "end",
|
|
189
|
+
}
|
|
190
|
+
|
|
112
191
|
/**
|
|
113
|
-
*
|
|
114
|
-
* @param $parent -- The parent node.
|
|
115
|
-
* @param $anchor -- The node to mount the component before.
|
|
116
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
117
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
118
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
192
|
+
* The content that is displayed for a MenuPopout when it is open.
|
|
119
193
|
*/
|
|
120
194
|
declare function MenuPopoutContent(
|
|
121
195
|
$parent: ParentNode,
|
|
122
196
|
$anchor: Node | null,
|
|
123
|
-
$props
|
|
197
|
+
$props: MenuPopoutContentProps | undefined,
|
|
124
198
|
$context?: Record<PropertyKey, any>,
|
|
125
199
|
$slots?: Record<string, SlotRender>,
|
|
126
200
|
): void;
|
|
127
201
|
|
|
128
202
|
|
|
129
203
|
|
|
204
|
+
interface MenuPopoutTriggerProps {
|
|
205
|
+
/** An ID for the root element */
|
|
206
|
+
id?: string;
|
|
207
|
+
/** Class name(s) for the root element */
|
|
208
|
+
class?: string,
|
|
209
|
+
/** The delay before showing the popout, in milliseconds */
|
|
210
|
+
hoverDelay?: number,
|
|
211
|
+
/** Whether this button is disabled */
|
|
212
|
+
disabled?: boolean,
|
|
213
|
+
}
|
|
214
|
+
|
|
130
215
|
/**
|
|
131
|
-
*
|
|
132
|
-
* @param $parent -- The parent node.
|
|
133
|
-
* @param $anchor -- The node to mount the component before.
|
|
134
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
135
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
136
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
216
|
+
* A button that is placed in a Menu or MenuGroup and signals a response by a user.
|
|
137
217
|
*/
|
|
138
218
|
declare function MenuPopoutTrigger(
|
|
139
219
|
$parent: ParentNode,
|
|
140
220
|
$anchor: Node | null,
|
|
141
|
-
$props
|
|
221
|
+
$props: MenuPopoutTriggerProps | undefined,
|
|
142
222
|
$context?: Record<PropertyKey, any>,
|
|
143
223
|
$slots?: Record<string, SlotRender>,
|
|
144
224
|
): void;
|
|
145
225
|
|
|
146
226
|
|
|
147
227
|
|
|
228
|
+
interface MenuRadioProps {
|
|
229
|
+
/** An ID for the root element */
|
|
230
|
+
id?: string;
|
|
231
|
+
/** Class name(s) for the root element */
|
|
232
|
+
class?: string,
|
|
233
|
+
/** The value of the item */
|
|
234
|
+
value?: string,
|
|
235
|
+
/** Whether this item is checked */
|
|
236
|
+
checked?: boolean,
|
|
237
|
+
/** Whether this item is disabled */
|
|
238
|
+
disabled?: boolean,
|
|
239
|
+
}
|
|
240
|
+
|
|
148
241
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* @param $anchor -- The node to mount the component before.
|
|
152
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
153
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
154
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
242
|
+
* A button that is placed in a Menu or MenuGroup to allow the user to select
|
|
243
|
+
* from a number of options.
|
|
155
244
|
*/
|
|
156
245
|
declare function MenuRadio(
|
|
157
246
|
$parent: ParentNode,
|
|
158
247
|
$anchor: Node | null,
|
|
159
|
-
$props
|
|
248
|
+
$props: MenuRadioProps | undefined,
|
|
160
249
|
$context?: Record<PropertyKey, any>,
|
|
161
250
|
$slots?: Record<string, SlotRender>,
|
|
162
251
|
): void;
|
|
163
252
|
|
|
164
253
|
|
|
165
254
|
|
|
255
|
+
interface MenuRadioGroupProps {
|
|
256
|
+
/** An ID for the root element */
|
|
257
|
+
id?: string;
|
|
258
|
+
/** Class name(s) for the root element */
|
|
259
|
+
class?: string,
|
|
260
|
+
/** An ARIA label for describing the menu to screen readers */
|
|
261
|
+
ariaLabel?: string,
|
|
262
|
+
/** The value of the checked MenuRadio */
|
|
263
|
+
value?: string | undefined,
|
|
264
|
+
/** Raised when the checked item has changed */
|
|
265
|
+
onchange?: (value: any) => void,
|
|
266
|
+
}
|
|
267
|
+
|
|
166
268
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @param $parent -- The parent node.
|
|
169
|
-
* @param $anchor -- The node to mount the component before.
|
|
170
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
171
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
172
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
269
|
+
* A container for a logical group of menu RadioGroup items.
|
|
173
270
|
*/
|
|
174
271
|
declare function MenuRadioGroup(
|
|
175
272
|
$parent: ParentNode,
|
|
176
273
|
$anchor: Node | null,
|
|
177
|
-
$props
|
|
274
|
+
$props: MenuRadioGroupProps | undefined,
|
|
178
275
|
$context?: Record<PropertyKey, any>,
|
|
179
276
|
$slots?: Record<string, SlotRender>,
|
|
180
277
|
): void;
|
|
181
278
|
|
|
182
279
|
|
|
183
280
|
|
|
281
|
+
interface MenuSeparatorProps {
|
|
282
|
+
/** An ID for the root element */
|
|
283
|
+
id?: string;
|
|
284
|
+
/** Class name(s) for the root element */
|
|
285
|
+
class?: string,
|
|
286
|
+
}
|
|
287
|
+
|
|
184
288
|
/**
|
|
185
|
-
*
|
|
186
|
-
* @param $parent -- The parent node.
|
|
187
|
-
* @param $anchor -- The node to mount the component before.
|
|
188
|
-
* @param $props -- The values that have been passed into the component as properties.
|
|
189
|
-
* @param $context -- Values that have been passed into the component from its ancestors.
|
|
190
|
-
* @param $slots -- Functions for rendering children into slot nodes within the component.
|
|
289
|
+
* An element in a menu that separates logical sets of menu items.
|
|
191
290
|
*/
|
|
192
291
|
declare function MenuSeparator(
|
|
193
292
|
$parent: ParentNode,
|
|
194
293
|
$anchor: Node | null,
|
|
195
|
-
$props
|
|
294
|
+
$props: MenuSeparatorProps | undefined,
|
|
196
295
|
$context?: Record<PropertyKey, any>,
|
|
197
296
|
$slots?: Record<string, SlotRender>,
|
|
198
297
|
): void;
|