@torpor/ui 0.4.0 → 1.0.1
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/README.md +83 -7
- package/dist/Accordion/Accordion.torp +42 -165
- package/dist/Accordion/AccordionContent.torp +6 -6
- package/dist/Accordion/AccordionHeader.torp +7 -11
- package/dist/Accordion/AccordionItem.torp +24 -24
- package/dist/Accordion/AccordionTrigger.torp +17 -8
- package/dist/Accordion/AccordionTypes.ts +1 -1
- package/dist/Accordion/index.d.ts +23 -25
- package/dist/Accordion/index.js +6 -22
- package/dist/Breadcrumb/Breadcrumb.torp +12 -10
- package/dist/Breadcrumb/BreadcrumbItem.torp +6 -6
- package/dist/Breadcrumb/BreadcrumbList.torp +21 -0
- package/dist/Breadcrumb/BreadcrumbSeparator.torp +4 -4
- package/dist/Breadcrumb/index.d.ts +39 -15
- package/dist/Breadcrumb/index.js +5 -14
- package/dist/Calendar/Calendar.torp +163 -156
- package/dist/Calendar/CalendarDay.torp +91 -45
- package/dist/Calendar/CalendarDayHeader.torp +36 -0
- package/dist/Calendar/CalendarGrid.torp +104 -0
- package/dist/Calendar/CalendarGridHeader.torp +43 -0
- package/dist/Calendar/CalendarHeader.torp +48 -0
- package/dist/Calendar/CalendarHeaderTrigger.torp +54 -0
- package/dist/Calendar/CalendarTypes.ts +24 -3
- package/dist/Calendar/buildDays.ts +54 -0
- package/dist/Calendar/index.d.ts +191 -5
- package/dist/Calendar/index.js +8 -10
- package/dist/Carousel/Carousel.torp +180 -0
- package/dist/Carousel/CarouselIndicators.torp +65 -0
- package/dist/Carousel/CarouselNext.torp +43 -0
- package/dist/Carousel/CarouselPrevious.torp +44 -0
- package/dist/Carousel/CarouselSlide.torp +57 -0
- package/dist/Carousel/CarouselTypes.ts +28 -0
- package/dist/Carousel/index.d.ts +147 -0
- package/dist/Carousel/index.js +6 -0
- package/dist/Charts/BarChart.torp +55 -144
- package/dist/Charts/Chart.torp +120 -0
- package/dist/Charts/ChartBars.torp +78 -0
- package/dist/Charts/ChartColumns.torp +66 -0
- package/dist/Charts/ChartGrid.torp +54 -0
- package/dist/Charts/ChartLines.torp +60 -0
- package/dist/Charts/ChartTypes.ts +25 -0
- package/dist/Charts/ChartXAxis.torp +85 -0
- package/dist/Charts/ChartYAxis.torp +107 -0
- package/dist/Charts/ColumnChart.torp +70 -0
- package/dist/Charts/GridLines.torp +4 -4
- package/dist/Charts/LineChart.torp +55 -178
- package/dist/Charts/PieChart.torp +14 -20
- package/dist/Charts/ScatterChart.torp +45 -38
- package/dist/Charts/SparkLine.torp +16 -19
- package/dist/Charts/XAxis.torp +14 -11
- package/dist/Charts/YAxis.torp +10 -8
- package/dist/Charts/index.d.ts +328 -79
- package/dist/Charts/index.js +17 -34
- package/dist/ColorPicker/ColorPalette.torp +154 -0
- package/dist/ColorPicker/ColorPicker.torp +157 -0
- package/dist/ColorPicker/index.d.ts +85 -0
- package/dist/ColorPicker/index.js +3 -0
- package/dist/ComboBox/ComboBox.torp +205 -0
- package/dist/ComboBox/ComboBoxContent.torp +120 -0
- package/dist/ComboBox/ComboBoxInput.torp +161 -0
- package/dist/ComboBox/ComboBoxTrigger.torp +49 -0
- package/dist/ComboBox/ComboBoxTypes.ts +39 -0
- package/dist/ComboBox/index.d.ts +154 -0
- package/dist/ComboBox/index.js +6 -0
- package/dist/CommandPalette/CommandPalette.torp +223 -0
- package/dist/CommandPalette/CommandTypes.ts +14 -0
- package/dist/CommandPalette/index.d.ts +45 -0
- package/dist/CommandPalette/index.js +2 -0
- package/dist/Contextual/Contextual.torp +32 -50
- package/dist/Contextual/ContextualContent.torp +29 -73
- package/dist/Contextual/ContextualHover.torp +112 -0
- package/dist/Contextual/ContextualTrigger.torp +31 -42
- package/dist/Contextual/ContextualTypes.ts +4 -17
- package/dist/Contextual/index.d.ts +44 -27
- package/dist/Contextual/index.js +5 -14
- package/dist/DataGrid/DataGrid.torp +496 -0
- package/dist/DataGrid/DataGridTypes.ts +25 -0
- package/dist/DataGrid/index.d.ts +90 -0
- package/dist/DataGrid/index.js +3 -0
- package/dist/DataGrid/sortRows.ts +32 -0
- package/dist/DatePicker/DatePicker.torp +222 -0
- package/dist/DatePicker/DatePickerHeader.torp +20 -0
- package/dist/DatePicker/index.d.ts +55 -0
- package/dist/DatePicker/index.js +2 -0
- package/dist/DateRangePicker/DateRangePicker.torp +315 -0
- package/dist/DateRangePicker/DateRangePickerDay.torp +137 -0
- package/dist/DateRangePicker/DateRangePickerTypes.ts +21 -0
- package/dist/DateRangePicker/index.d.ts +76 -0
- package/dist/DateRangePicker/index.js +3 -0
- package/dist/Dialog/Dialog.torp +24 -17
- package/dist/Dialog/DialogBody.torp +5 -9
- package/dist/Dialog/DialogButton.torp +12 -12
- package/dist/Dialog/DialogFooter.torp +3 -7
- package/dist/Dialog/DialogHeader.torp +6 -10
- package/dist/Dialog/index.d.ts +27 -27
- package/dist/Dialog/index.js +6 -22
- package/dist/Disclosure/Disclosure.torp +18 -18
- package/dist/Disclosure/DisclosureContent.torp +5 -6
- package/dist/Disclosure/DisclosureHeader.torp +7 -11
- package/dist/Disclosure/DisclosureTrigger.torp +4 -5
- package/dist/Disclosure/index.d.ts +14 -16
- package/dist/Disclosure/index.js +5 -18
- package/dist/Drawer/Drawer.torp +19 -49
- package/dist/Drawer/DrawerContent.torp +70 -13
- package/dist/Drawer/DrawerOverlay.torp +4 -4
- package/dist/Drawer/DrawerTrigger.torp +16 -4
- package/dist/Drawer/DrawerTypes.ts +3 -0
- package/dist/Drawer/index.d.ts +16 -20
- package/dist/Drawer/index.js +5 -18
- package/dist/FocusGroup/FocusGroup.torp +70 -0
- package/dist/FocusGroup/FocusGroupButton.torp +59 -0
- package/dist/FocusGroup/FocusGroupTypes.ts +14 -0
- package/dist/FocusGroup/index.d.ts +44 -0
- package/dist/FocusGroup/index.js +3 -0
- package/dist/Form/CheckBox.torp +27 -18
- package/dist/Form/Field.torp +17 -17
- package/dist/Form/File.torp +31 -22
- package/dist/Form/FileDrop.torp +187 -0
- package/dist/Form/Form.torp +24 -22
- package/dist/Form/FormTypes.ts +2 -0
- package/dist/Form/FormValues.torp +37 -0
- package/dist/Form/Hidden.torp +4 -12
- package/dist/Form/Input.torp +38 -32
- package/dist/Form/Label.torp +3 -3
- package/dist/Form/Message.torp +13 -5
- package/dist/Form/MessageSummary.torp +5 -4
- package/dist/Form/Option.torp +11 -7
- package/dist/Form/Select.torp +32 -28
- package/dist/Form/TextArea.torp +35 -31
- package/dist/Form/Toggle.torp +109 -0
- package/dist/Form/index.d.ts +178 -79
- package/dist/Form/index.js +16 -50
- package/dist/ListBox/ListBox.torp +253 -150
- package/dist/ListBox/ListBoxItem.torp +54 -30
- package/dist/ListBox/ListBoxSeparator.torp +5 -2
- package/dist/ListBox/ListBoxTypes.ts +23 -5
- package/dist/ListBox/LoadedListBoxItems.torp +41 -0
- package/dist/ListBox/index.d.ts +56 -17
- package/dist/ListBox/index.js +4 -14
- package/dist/MaskedInput/MaskedInput.torp +143 -0
- package/dist/MaskedInput/index.d.ts +52 -0
- package/dist/MaskedInput/index.js +2 -0
- package/dist/Menu/Menu.torp +86 -71
- package/dist/Menu/MenuButton.torp +17 -10
- package/dist/Menu/MenuCheck.torp +22 -18
- package/dist/Menu/MenuGroup.torp +4 -4
- package/dist/Menu/MenuIndicator.torp +5 -13
- package/dist/Menu/MenuPopout.torp +20 -50
- package/dist/Menu/MenuPopoutContent.torp +15 -66
- package/dist/Menu/MenuPopoutTrigger.torp +19 -100
- package/dist/Menu/MenuRadio.torp +25 -26
- package/dist/Menu/MenuRadioGroup.torp +25 -68
- package/dist/Menu/MenuSeparator.torp +3 -2
- package/dist/Menu/MenuTypes.ts +9 -19
- package/dist/Menu/index.d.ts +45 -51
- package/dist/Menu/index.js +12 -46
- package/dist/MenuBar/MenuBar.torp +31 -83
- package/dist/MenuBar/MenuBarItem.torp +33 -51
- package/dist/MenuBar/MenuBarItemContent.torp +15 -101
- package/dist/MenuBar/MenuBarItemTrigger.torp +20 -55
- package/dist/MenuBar/MenuBarTypes.ts +11 -10
- package/dist/MenuBar/index.d.ts +17 -19
- package/dist/MenuBar/index.js +5 -18
- package/dist/Modal/Modal.torp +22 -47
- package/dist/Modal/ModalContent.torp +21 -44
- package/dist/Modal/ModalOverlay.torp +4 -4
- package/dist/Modal/ModalTrigger.torp +16 -32
- package/dist/Modal/ModalTypes.ts +5 -16
- package/dist/Modal/index.d.ts +17 -29
- package/dist/Modal/index.js +29 -28
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/showPrompt.ts +2 -2
- package/dist/NavMenu/NavMenu.torp +22 -111
- package/dist/NavMenu/NavMenuButton.torp +7 -8
- package/dist/NavMenu/NavMenuElement.torp +6 -7
- package/dist/NavMenu/NavMenuGroup.torp +5 -5
- package/dist/NavMenu/NavMenuGroupHeader.torp +5 -8
- package/dist/NavMenu/NavMenuLink.torp +7 -10
- package/dist/NavMenu/NavMenuPopout.torp +15 -60
- package/dist/NavMenu/NavMenuPopoutContent.torp +14 -73
- package/dist/NavMenu/NavMenuPopoutTrigger.torp +17 -99
- package/dist/NavMenu/NavMenuSeparator.torp +3 -7
- package/dist/NavMenu/NavMenuTypes.ts +4 -14
- package/dist/NavMenu/index.d.ts +40 -44
- package/dist/NavMenu/index.js +11 -42
- package/dist/Notification/Notification.torp +12 -24
- package/dist/Notification/NotificationClose.torp +6 -3
- package/dist/Notification/NotificationContainer.torp +3 -7
- package/dist/Notification/NotificationContent.torp +3 -7
- package/dist/Notification/NotificationTypes.ts +1 -1
- package/dist/Notification/index.d.ts +15 -12
- package/dist/Notification/index.js +22 -32
- package/dist/Notification/index.js.map +1 -1
- package/dist/NumberInput/NumberInput.torp +255 -0
- package/dist/NumberInput/index.d.ts +44 -0
- package/dist/NumberInput/index.js +2 -0
- package/dist/Pagination/Pagination.torp +41 -34
- package/dist/Pagination/PaginationItem.torp +50 -13
- package/dist/Pagination/PaginationTypes.ts +3 -6
- package/dist/Pagination/buildPages.ts +9 -5
- package/dist/Pagination/index.d.ts +19 -9
- package/dist/Pagination/index.js +3 -40
- package/dist/Popover/Popover.torp +32 -50
- package/dist/Popover/PopoverContent.torp +27 -76
- package/dist/Popover/PopoverHover.torp +90 -0
- package/dist/Popover/PopoverTrigger.torp +17 -40
- package/dist/Popover/PopoverTypes.ts +4 -17
- package/dist/Popover/index.d.ts +40 -25
- package/dist/Popover/index.js +18 -18
- package/dist/Popover/index.js.map +1 -1
- package/dist/Progress/Progress.torp +88 -0
- package/dist/Progress/index.d.ts +37 -0
- package/dist/Progress/index.js +2 -0
- package/dist/Rating/Rating.torp +225 -0
- package/dist/Rating/index.d.ts +44 -0
- package/dist/Rating/index.js +2 -0
- package/dist/SegmentedControl/SegmentedControl.torp +233 -0
- package/dist/SegmentedControl/SegmentedControlTypes.ts +26 -0
- package/dist/SegmentedControl/SegmentedItem.torp +78 -0
- package/dist/SegmentedControl/index.d.ts +74 -0
- package/dist/SegmentedControl/index.js +3 -0
- package/dist/SelectBox/SelectBox.torp +107 -53
- package/dist/SelectBox/SelectBoxContent.torp +49 -19
- package/dist/SelectBox/SelectBoxTrigger.torp +108 -8
- package/dist/SelectBox/SelectBoxTypes.ts +26 -11
- package/dist/SelectBox/index.d.ts +39 -54
- package/dist/SelectBox/index.js +5 -18
- package/dist/Slider/Slider.torp +245 -0
- package/dist/Slider/index.d.ts +45 -0
- package/dist/Slider/index.js +2 -0
- package/dist/Splitter/Splitter.torp +156 -0
- package/dist/Splitter/SplitterHandle.torp +161 -0
- package/dist/Splitter/SplitterPane.torp +63 -0
- package/dist/Splitter/SplitterTypes.ts +31 -0
- package/dist/Splitter/index.d.ts +103 -0
- package/dist/Splitter/index.js +4 -0
- package/dist/Stepper/Stepper.torp +146 -0
- package/dist/Stepper/StepperMarker.torp +24 -0
- package/dist/Stepper/StepperNext.torp +44 -0
- package/dist/Stepper/StepperPrevious.torp +44 -0
- package/dist/Stepper/StepperStep.torp +90 -0
- package/dist/Stepper/StepperTypes.ts +30 -0
- package/dist/Stepper/index.d.ts +149 -0
- package/dist/Stepper/index.js +6 -0
- package/dist/TabGroup/TabContent.torp +6 -6
- package/dist/TabGroup/TabGroup.torp +97 -113
- package/dist/TabGroup/TabGroupTypes.ts +1 -1
- package/dist/TabGroup/TabHeader.torp +23 -19
- package/dist/TabGroup/TabList.torp +8 -21
- package/dist/TabGroup/TabTrigger.torp +6 -7
- package/dist/TabGroup/index.d.ts +26 -26
- package/dist/TabGroup/index.js +6 -22
- package/dist/TagInput/TagInput.torp +378 -0
- package/dist/TagInput/index.d.ts +48 -0
- package/dist/TagInput/index.js +2 -0
- package/dist/TimePicker/TimePicker.torp +462 -0
- package/dist/TimePicker/index.d.ts +53 -0
- package/dist/TimePicker/index.js +2 -0
- package/dist/ToolBar/ToolBar.torp +29 -110
- package/dist/ToolBar/ToolBarButton.torp +7 -8
- package/dist/ToolBar/ToolBarElement.torp +7 -11
- package/dist/ToolBar/ToolBarPopout.torp +16 -68
- package/dist/ToolBar/ToolBarPopoutContent.torp +15 -73
- package/dist/ToolBar/ToolBarPopoutTrigger.torp +19 -110
- package/dist/ToolBar/ToolBarSeparator.torp +3 -7
- package/dist/ToolBar/ToolBarTypes.ts +7 -14
- package/dist/ToolBar/index.d.ts +30 -32
- package/dist/ToolBar/index.js +8 -30
- package/dist/Tree/Tree.torp +395 -0
- package/dist/Tree/TreeItem.torp +176 -0
- package/dist/Tree/TreeItemChildren.torp +60 -0
- package/dist/Tree/TreeItemContent.torp +46 -0
- package/dist/Tree/TreeItemLabel.torp +94 -0
- package/dist/Tree/TreeItemTrigger.torp +78 -0
- package/dist/Tree/TreeLoadedChildren.torp +122 -0
- package/dist/Tree/TreeTypes.ts +63 -0
- package/dist/Tree/index.d.ts +262 -0
- package/dist/Tree/index.js +7 -0
- package/dist/icons/ChevronDoubleLeft.torp +19 -0
- package/dist/icons/ChevronDoubleRight.torp +19 -0
- package/dist/icons/index.d.ts +61 -1
- package/dist/icons/index.js +17 -58
- package/dist/loader-DEeG5vFY.js +44 -0
- package/dist/loader-DEeG5vFY.js.map +1 -0
- package/dist/motion/index.d.ts +12 -8
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +70 -88
- package/dist/motion/index.js.map +1 -1
- package/dist/mount/draggable.ts +63 -0
- package/dist/mount/dropTarget.ts +108 -0
- package/dist/mount/hoverTrigger.ts +1 -1
- package/dist/utils/$handle.ts +23 -0
- package/dist/utils/LoadedItems.torp +47 -0
- package/dist/utils/PopoutClickTrigger.torp +99 -0
- package/dist/utils/PopoutTypes.ts +59 -12
- package/dist/utils/SubmenuPopout.torp +89 -0
- package/dist/utils/SubmenuPopoutContent.torp +87 -0
- package/dist/utils/SubmenuPopoutTrigger.torp +160 -0
- package/dist/utils/chartColors.ts +13 -13
- package/dist/utils/chartLayout.ts +143 -0
- package/dist/utils/colorUtils.ts +103 -0
- package/dist/utils/createItemGroup.ts +152 -0
- package/dist/utils/dateUtils.ts +8 -7
- package/dist/utils/documentEvents.ts +4 -4
- package/dist/utils/dragState.ts +86 -0
- package/dist/utils/focusGroup.ts +204 -0
- package/dist/utils/focusItem.ts +44 -0
- package/dist/utils/formField.ts +70 -0
- package/dist/utils/hoverOpen.ts +50 -0
- package/dist/utils/hoverReveal.ts +194 -0
- package/dist/utils/loader.ts +113 -0
- package/dist/utils/maskUtils.ts +98 -0
- package/dist/utils/popoutContent.ts +137 -0
- package/dist/utils/reorderList.ts +52 -0
- package/package.json +97 -22
- package/dist/Accordion/index.js.map +0 -1
- package/dist/Breadcrumb/index.js.map +0 -1
- package/dist/Calendar/index.js.map +0 -1
- package/dist/Charts/index.js.map +0 -1
- package/dist/Contextual/index.js.map +0 -1
- package/dist/Dialog/index.js.map +0 -1
- package/dist/Disclosure/index.js.map +0 -1
- package/dist/Drawer/index.js.map +0 -1
- package/dist/Form/index.js.map +0 -1
- package/dist/ListBox/index.js.map +0 -1
- package/dist/Menu/index.js.map +0 -1
- package/dist/MenuBar/index.js.map +0 -1
- package/dist/NavMenu/index.js.map +0 -1
- package/dist/Pagination/index.js.map +0 -1
- package/dist/SelectBox/SelectBoxInput.torp +0 -95
- package/dist/SelectBox/index.js.map +0 -1
- package/dist/TabGroup/index.js.map +0 -1
- package/dist/ToolBar/index.js.map +0 -1
- package/dist/icons/index.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/metafile-esm.json +0 -1
- package/dist/motion/fade.ts +0 -16
- package/dist/motion/grow.ts +0 -23
- package/dist/motion/measure.ts +0 -28
- package/dist/motion/slide.ts +0 -45
- package/dist/mount/index.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -2
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { Bindable, ClassValue, StyleValue } from "@torpor/view";
|
|
2
|
+
import $handle from "../utils/$handle";
|
|
3
|
+
import { type PopoutContext, PopoutContextName } from "../utils/PopoutTypes";
|
|
4
|
+
import {
|
|
5
|
+
type ContextualContext,
|
|
6
|
+
ContextualContextName,
|
|
7
|
+
type ContextualState,
|
|
8
|
+
type Point,
|
|
9
|
+
} from "./ContextualTypes";
|
|
4
10
|
|
|
5
11
|
interface ContextualProps {
|
|
6
12
|
/** An ID for the root element */
|
|
7
13
|
id?: string;
|
|
8
14
|
/** Classes for the root element */
|
|
9
|
-
class?: ClassValue
|
|
15
|
+
class?: ClassValue;
|
|
10
16
|
/** Styles for the root element */
|
|
11
|
-
style?: StyleValue
|
|
17
|
+
style?: StyleValue;
|
|
12
18
|
/** 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 */
|
|
13
|
-
modal?: boolean
|
|
19
|
+
modal?: boolean;
|
|
14
20
|
/** Whether the contextual is visible */
|
|
15
|
-
visible
|
|
21
|
+
visible: Bindable<boolean | undefined>;
|
|
16
22
|
/** The element to anchor this contextual to, as an alternative to supplying a ContextualTrigger */
|
|
17
|
-
anchor?: HTMLElement
|
|
23
|
+
anchor?: HTMLElement;
|
|
18
24
|
/** The position to display this contextual at */
|
|
19
|
-
position?: Point
|
|
20
|
-
/** A function to be called when the user selects a response */
|
|
21
|
-
callback?: ((value: any) => void),
|
|
22
|
-
/** Raised when this contextual is opened or closed */
|
|
23
|
-
ontoggle?: (open: boolean) => void,
|
|
25
|
+
position?: Point;
|
|
24
26
|
/** Raised when the contextual has opened */
|
|
25
|
-
onopen?: () => void
|
|
27
|
+
onopen?: () => void;
|
|
26
28
|
/** Raised when the contextual has closed */
|
|
27
|
-
onclose?: (result: any) => void
|
|
29
|
+
onclose?: (result: any) => void;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -42,19 +44,16 @@ interface ContextualProps {
|
|
|
42
44
|
export default function Contextual($props: ContextualProps | undefined) {
|
|
43
45
|
let $state: ContextualState = $watch({
|
|
44
46
|
visible: false,
|
|
45
|
-
position: { x: 0, y: 0 }
|
|
46
|
-
|
|
47
|
+
position: { x: 0, y: 0 },
|
|
48
|
+
contentId: undefined,
|
|
49
|
+
triggerId: undefined,
|
|
50
|
+
contentRole: undefined,
|
|
51
|
+
});
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
$bind($state, $props, "visible");
|
|
49
54
|
$run(() => {
|
|
50
|
-
$state.visible = $props?.visible ?? false;
|
|
51
55
|
$state.position = $props?.position ?? { x: 0, y: 0 };
|
|
52
56
|
});
|
|
53
|
-
$run(() => {
|
|
54
|
-
if ($props !== undefined) {
|
|
55
|
-
$props.visible = $state.visible;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
57
|
|
|
59
58
|
let result: any;
|
|
60
59
|
|
|
@@ -72,22 +71,14 @@ export default function Contextual($props: ContextualProps | undefined) {
|
|
|
72
71
|
let popoutContext: PopoutContext = context;
|
|
73
72
|
$context[PopoutContextName] = popoutContext;
|
|
74
73
|
|
|
75
|
-
// Dispatch the
|
|
76
|
-
|
|
77
|
-
$run(() => {
|
|
78
|
-
const ontoggle = $props?.ontoggle;
|
|
79
|
-
const onopen = $props?.onopen;
|
|
80
|
-
const onclose = $props?.onclose;
|
|
74
|
+
// Dispatch the open/close events when the contextual is opened or closed
|
|
75
|
+
$handle((first) => {
|
|
81
76
|
const visible = $state.visible;
|
|
82
|
-
if (
|
|
83
|
-
|
|
77
|
+
if (first) return;
|
|
78
|
+
if (visible) {
|
|
79
|
+
$props?.onopen?.();
|
|
84
80
|
} else {
|
|
85
|
-
|
|
86
|
-
if (visible) {
|
|
87
|
-
if (onopen) onopen()
|
|
88
|
-
} else {
|
|
89
|
-
if (onclose) onclose(result);
|
|
90
|
-
}
|
|
81
|
+
$props?.onclose?.(result);
|
|
91
82
|
}
|
|
92
83
|
});
|
|
93
84
|
|
|
@@ -110,25 +101,16 @@ export default function Contextual($props: ContextualProps | undefined) {
|
|
|
110
101
|
|
|
111
102
|
// Hide the contextual
|
|
112
103
|
$state.visible = false;
|
|
113
|
-
|
|
114
|
-
// Call the callback
|
|
115
|
-
if ($props?.callback) {
|
|
116
|
-
$props.callback(result);
|
|
117
|
-
}
|
|
118
104
|
}
|
|
119
105
|
|
|
120
|
-
function handleClickOutside(e: MouseEvent) {
|
|
106
|
+
function handleClickOutside(e: MouseEvent | KeyboardEvent) {
|
|
121
107
|
e.preventDefault();
|
|
122
108
|
$state.visible = false;
|
|
123
109
|
}
|
|
124
110
|
|
|
125
111
|
@render {
|
|
126
|
-
<div
|
|
127
|
-
{$props?.id}
|
|
128
|
-
class={["torp-context", $props?.class]}
|
|
129
|
-
{$props?.style}
|
|
130
|
-
>
|
|
112
|
+
<div {$props?.id} class={["torp-context", $props?.class]} {$props?.style}>
|
|
131
113
|
<slot />
|
|
132
114
|
</div>
|
|
133
115
|
}
|
|
134
|
-
}
|
|
116
|
+
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import getId from "../utils/getId";
|
|
3
|
+
import { createPopoutContent } from "../utils/popoutContent";
|
|
4
4
|
import setContextPosition from "../utils/setContextPosition";
|
|
5
|
-
import {
|
|
5
|
+
import { type ContextualContext, ContextualContextName } from "./ContextualTypes";
|
|
6
6
|
|
|
7
7
|
interface ContextualContentProps {
|
|
8
8
|
/** An ID for the root element */
|
|
9
9
|
id?: string;
|
|
10
10
|
/** Classes for the root element */
|
|
11
|
-
class?: ClassValue
|
|
11
|
+
class?: ClassValue;
|
|
12
12
|
/** Styles for the root element */
|
|
13
|
-
style?: StyleValue
|
|
13
|
+
style?: StyleValue;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The content that is displayed for a Contextual when it is open, displayed at the
|
|
18
18
|
* position that the user right-clicked.
|
|
19
19
|
*/
|
|
20
|
-
export default function ContextualContent($props: ContextualContentProps | undefined) {
|
|
21
|
-
let
|
|
22
|
-
let shown = false;
|
|
23
|
-
let closeOnClick = false;
|
|
20
|
+
export default function ContextualContent($props: ContextualContentProps | undefined) {
|
|
21
|
+
let defaultId = getId();
|
|
24
22
|
|
|
25
23
|
// Get stuff out of the ContextualContext
|
|
26
24
|
const context = $context[ContextualContextName] as ContextualContext;
|
|
@@ -29,81 +27,39 @@ export default function ContextualContent($props: ContextualContentProps | undef
|
|
|
29
27
|
}
|
|
30
28
|
let $state = context.state;
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
hide();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
function show() {
|
|
39
|
-
shown = true;
|
|
40
|
-
|
|
41
|
-
// HACK: Because this Contextual could be shown with a click, we need to wait for another mousedown
|
|
42
|
-
// before we close on click. Otherwise the click immediately bubbles to the document
|
|
43
|
-
closeOnClick = false;
|
|
44
|
-
addDocumentEvent("mousedown", handleDocumentMouseDown);
|
|
45
|
-
addDocumentEvent("click", handleDocumentClick);
|
|
46
|
-
|
|
47
|
-
// Set the position and listen for window resize and scroll to reset the position
|
|
48
|
-
setPosition();
|
|
49
|
-
const anchorElement = context.anchorElement!;
|
|
50
|
-
const scrollParent = getScrollParent(anchorElement)
|
|
51
|
-
scrollParent.addEventListener("resize", setPosition);
|
|
52
|
-
scrollParent.addEventListener("scroll", setPosition);
|
|
53
|
-
if (context.focusFirstElement) {
|
|
54
|
-
context.focusFirstElement();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function hide() {
|
|
59
|
-
if (!shown) return;
|
|
60
|
-
|
|
61
|
-
removeDocumentEvent("mousedown", handleDocumentMouseDown);
|
|
62
|
-
removeDocumentEvent("click", handleDocumentClick);
|
|
63
|
-
|
|
64
|
-
// Stop listening for window resize and focus the anchor element per WAI guidelines
|
|
65
|
-
const anchorElement = context.anchorElement!;
|
|
66
|
-
const scrollParent = getScrollParent(anchorElement)
|
|
67
|
-
scrollParent.removeEventListener("resize", setPosition);
|
|
68
|
-
scrollParent.removeEventListener("scroll", setPosition);
|
|
69
|
-
if (anchorElement.focus) {
|
|
70
|
-
anchorElement.focus();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function handleDocumentMouseDown() {
|
|
75
|
-
closeOnClick = true;
|
|
76
|
-
}
|
|
30
|
+
// Set the content ID so that the trigger can use it with aria-controls
|
|
31
|
+
$state.contentId = $props?.id ?? defaultId;
|
|
77
32
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
33
|
+
const popout = createPopoutContent({
|
|
34
|
+
getAnchor: () => context.anchorElement,
|
|
35
|
+
getContent: () => div,
|
|
36
|
+
close: (e) => context.handleClickOutside?.(e),
|
|
37
|
+
position: () => {
|
|
38
|
+
if (context.anchorElement && div && $state.position) {
|
|
39
|
+
setContextPosition(context.anchorElement, div, $state.position);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
ignoreAnchorClicks: true,
|
|
43
|
+
focusFirstElement: () => context.focusFirstElement?.(),
|
|
44
|
+
refocusAnchorOnHide: true,
|
|
45
|
+
});
|
|
88
46
|
|
|
89
|
-
|
|
90
|
-
if (!context.anchorElement) {
|
|
91
|
-
throw new Error("ContextualContent must have an anchor element");
|
|
92
|
-
}
|
|
47
|
+
let div: HTMLDivElement;
|
|
93
48
|
|
|
94
|
-
|
|
95
|
-
|
|
49
|
+
$run(() => {
|
|
50
|
+
if (!$state.visible) {
|
|
51
|
+
popout.hide();
|
|
96
52
|
}
|
|
97
|
-
}
|
|
53
|
+
});
|
|
98
54
|
|
|
99
55
|
@render {
|
|
100
56
|
@if ($state.visible) {
|
|
101
57
|
<div
|
|
102
|
-
{$props?.id}
|
|
58
|
+
id={$props?.id ?? defaultId}
|
|
103
59
|
class={["torp-popover-content-contextual", $props?.class]}
|
|
104
60
|
{$props?.style}
|
|
105
61
|
&ref={div}
|
|
106
|
-
onmount={show}
|
|
62
|
+
onmount={(_el) => popout.show()}
|
|
107
63
|
>
|
|
108
64
|
<slot />
|
|
109
65
|
</div>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
|
+
import { createHoverReveal } from "../utils/hoverReveal";
|
|
3
|
+
import getId from "../utils/getId";
|
|
4
|
+
import {
|
|
5
|
+
type ContextualContext,
|
|
6
|
+
ContextualContextName,
|
|
7
|
+
} from "./ContextualTypes";
|
|
8
|
+
|
|
9
|
+
interface ContextualHoverProps {
|
|
10
|
+
/** An ID for the root element */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Classes for the root element */
|
|
13
|
+
class?: ClassValue;
|
|
14
|
+
/** Styles for the root element */
|
|
15
|
+
style?: StyleValue;
|
|
16
|
+
/** Milliseconds to wait before opening (default 500; 0 opens immediately) */
|
|
17
|
+
hoverDelay?: number;
|
|
18
|
+
/** Milliseconds to wait after the pointer or focus leaves before closing (default 300) */
|
|
19
|
+
exitGrace?: number;
|
|
20
|
+
/** Whether hovering and focusing are ignored */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An element that shows a Contextual while hovered at the pointer's
|
|
26
|
+
* location, with proper hover semantics: an intent delay before opening
|
|
27
|
+
* (so passing over the element doesn't flash a window), and an exit grace
|
|
28
|
+
* period after leaving (so moving into the contextual content doesn't close
|
|
29
|
+
* it).
|
|
30
|
+
*
|
|
31
|
+
* Focusing the element opens it immediately; blurring closes it. Use this
|
|
32
|
+
* in place of ContextualTrigger:
|
|
33
|
+
*
|
|
34
|
+
* ```
|
|
35
|
+
* <Contextual>
|
|
36
|
+
* <ContextualHover>Anything can go here</ContextualHover>
|
|
37
|
+
* <ContextualContent />
|
|
38
|
+
* </Contextual>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export default function ContextualHover($props?: ContextualHoverProps) {
|
|
42
|
+
let defaultId = getId();
|
|
43
|
+
|
|
44
|
+
// Get stuff out of the ContextualContext
|
|
45
|
+
const context = $context[ContextualContextName] as ContextualContext;
|
|
46
|
+
if (!context) {
|
|
47
|
+
throw new Error("ContextualHover must be contained within a Contextual");
|
|
48
|
+
}
|
|
49
|
+
const $state = context.state;
|
|
50
|
+
|
|
51
|
+
// Set the trigger ID so that it can be used with aria-labelledby
|
|
52
|
+
$state.triggerId = $props?.id ?? defaultId;
|
|
53
|
+
|
|
54
|
+
let node: HTMLElement;
|
|
55
|
+
|
|
56
|
+
function activate(e: MouseEvent | TouchEvent) {
|
|
57
|
+
if ($state.position) {
|
|
58
|
+
// Get the position relative to the element, so we can reposition on scroll
|
|
59
|
+
const rect = node.getBoundingClientRect();
|
|
60
|
+
const point = e instanceof TouchEvent ? e.touches[0] : e;
|
|
61
|
+
$state.position = {
|
|
62
|
+
x: (point?.clientX ?? 0) - rect.left,
|
|
63
|
+
y: (point?.clientY ?? 0) - rect.top,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function setVisible(visible: boolean) {
|
|
69
|
+
$state.visible = visible;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const hover = createHoverReveal({
|
|
73
|
+
show: () => setVisible(true),
|
|
74
|
+
hide: () => setVisible(false),
|
|
75
|
+
isVisible: () => $state.visible,
|
|
76
|
+
disabled: () => $props?.disabled === true,
|
|
77
|
+
getContent: () => ($state.contentId ? document.getElementById($state.contentId) : undefined),
|
|
78
|
+
hoverDelay: $props?.hoverDelay,
|
|
79
|
+
exitGrace: $props?.exitGrace,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
$run(() => {
|
|
83
|
+
return () => hover.dispose();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
function handleEnter() {
|
|
87
|
+
activate({ clientX: node.offsetWidth / 2, clientY: node.offsetHeight / 2 } as MouseEvent);
|
|
88
|
+
hover.handleEnter();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@render {
|
|
92
|
+
<div
|
|
93
|
+
id={$props?.id ?? defaultId}
|
|
94
|
+
class={["torp-contextual-hover", $props?.class]}
|
|
95
|
+
{$props?.style}
|
|
96
|
+
tabindex="0"
|
|
97
|
+
aria-haspopup={$state.contentRole ?? "true"}
|
|
98
|
+
aria-expanded={$state.visible ? "true" : "false"}
|
|
99
|
+
aria-controls={$state.contentId}
|
|
100
|
+
onmouseenter={handleEnter}
|
|
101
|
+
onmouseleave={(e: MouseEvent) => hover.handleLeave(e)}
|
|
102
|
+
onfocus={() => hover.handleFocus()}
|
|
103
|
+
onblur={(e: FocusEvent) => hover.handleBlur(e)}
|
|
104
|
+
onmount={(el) => {
|
|
105
|
+
node = el;
|
|
106
|
+
context.anchorElement = el;
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<slot />
|
|
110
|
+
</div>
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,70 +1,59 @@
|
|
|
1
1
|
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import PopoutClickTrigger from "../utils/PopoutClickTrigger.torp";
|
|
3
|
+
import {
|
|
4
|
+
type ContextualContext,
|
|
5
|
+
ContextualContextName,
|
|
6
|
+
type Point,
|
|
7
|
+
} from "./ContextualTypes";
|
|
4
8
|
|
|
5
9
|
interface ContextualTriggerProps {
|
|
6
10
|
/** An ID for the root element */
|
|
7
11
|
id?: string;
|
|
8
12
|
/** Classes for the root element */
|
|
9
|
-
class?: ClassValue
|
|
13
|
+
class?: ClassValue;
|
|
10
14
|
/** Styles for the root element */
|
|
11
|
-
style?: StyleValue
|
|
12
|
-
/** Whether the popover is activated by click/press or by hover **/
|
|
13
|
-
activation?: "press" | "hover"
|
|
15
|
+
style?: StyleValue;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
|
-
* The element that causes a Contextual to appear or disappear when
|
|
19
|
+
* The element that causes a Contextual to appear or disappear when
|
|
20
|
+
* right-clicked.
|
|
21
|
+
*
|
|
22
|
+
* For hover activation, use ContextualHover instead -- hover surfaces need
|
|
23
|
+
* an intent delay and an exit grace period that a right-click region
|
|
24
|
+
* doesn't.
|
|
18
25
|
*/
|
|
19
|
-
export default function ContextualTrigger($props
|
|
20
|
-
let activation = $props?.activation ?? "press";
|
|
21
|
-
|
|
26
|
+
export default function ContextualTrigger($props?: ContextualTriggerProps) {
|
|
22
27
|
// Get stuff out of the ContextualContext
|
|
23
28
|
const context = $context[ContextualContextName] as ContextualContext;
|
|
24
29
|
if (!context) {
|
|
25
30
|
throw new Error("ContextualTrigger must be contained within a Contextual");
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function handleContextualMenu(e: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {
|
|
30
|
-
if (activation !== "press") return;
|
|
31
|
-
|
|
32
|
-
e.preventDefault();
|
|
33
|
-
if ($state.position) {
|
|
34
|
-
// Get the position relative to the element, so we can reposition on scroll
|
|
35
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
36
|
-
const x = e.clientX - rect.left;
|
|
37
|
-
const y = e.clientY - rect.top;
|
|
38
|
-
$state.position = { x, y };
|
|
39
|
-
//$state.position = { x: window.scrollX + e.clientX, y: window.scrollY + e.clientY };
|
|
40
|
-
}
|
|
41
|
-
$state.visible = !$state.visible;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function handleHover(node: HTMLElement, e: MouseEvent) {
|
|
45
|
-
if (activation !== "hover") return;
|
|
32
|
+
const $state = context.state;
|
|
46
33
|
|
|
34
|
+
function activate(node: HTMLElement, e: MouseEvent) {
|
|
47
35
|
if ($state.position) {
|
|
48
36
|
// Get the position relative to the element, so we can reposition on scroll
|
|
49
37
|
const rect = node.getBoundingClientRect();
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
const point: Point = {
|
|
39
|
+
x: e.clientX - rect.left,
|
|
40
|
+
y: e.clientY - rect.top,
|
|
41
|
+
};
|
|
42
|
+
$state.position = point;
|
|
54
43
|
}
|
|
55
|
-
$state.visible = !$state.visible
|
|
56
44
|
}
|
|
57
45
|
|
|
58
46
|
@render {
|
|
59
|
-
<
|
|
60
|
-
{$props?.id}
|
|
61
|
-
class={
|
|
62
|
-
{$props?.style}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
<PopoutClickTrigger
|
|
48
|
+
id={$props?.id}
|
|
49
|
+
class={$props?.class ?? "torp-popover-trigger-contextual"}
|
|
50
|
+
style={$props?.style}
|
|
51
|
+
context={context}
|
|
52
|
+
tag="div"
|
|
53
|
+
event="contextmenu"
|
|
54
|
+
onactivate={activate}
|
|
66
55
|
>
|
|
67
56
|
<slot />
|
|
68
|
-
</
|
|
57
|
+
</PopoutClickTrigger>
|
|
69
58
|
}
|
|
70
59
|
}
|
|
@@ -1,26 +1,13 @@
|
|
|
1
|
+
import { type PopoutContext, type PopoutState } from "../utils/PopoutTypes";
|
|
2
|
+
|
|
1
3
|
export const ContextualContextName: unique symbol = Symbol.for("torp.Contextual");
|
|
2
4
|
|
|
3
5
|
/** The shared context for popover components (Contextual, Prompt and Contextual) */
|
|
4
|
-
export interface ContextualContext {
|
|
5
|
-
handleButton: (type: "confirm" | "cancel" | undefined, value?: any) => void;
|
|
6
|
-
// HACK: We need to be able to let children (i.e. Dialogs) override the click outside functionality
|
|
7
|
-
// There may be a more elegant way to accomplish this too
|
|
8
|
-
handleClickOutside?: (e: MouseEvent) => void;
|
|
6
|
+
export interface ContextualContext extends PopoutContext {
|
|
9
7
|
state: ContextualState;
|
|
10
|
-
//modal: boolean;
|
|
11
|
-
anchorElement?: HTMLElement;
|
|
12
|
-
// HACK: focusFirstElement is necessary because if we focus the first element e.g. in a Dialog's
|
|
13
|
-
// onMount, it will scroll the page to the focused element and mess up our careful positioning
|
|
14
|
-
// We need to be able to manually set the order to
|
|
15
|
-
// 1. set visible (so we have an element with content)
|
|
16
|
-
// 2. set position (so the element is in the right place)
|
|
17
|
-
// 3. set focus (for accessibility)
|
|
18
|
-
// There may be a more elegant way to accomplish this!
|
|
19
|
-
focusFirstElement?: () => void;
|
|
20
8
|
}
|
|
21
9
|
|
|
22
|
-
export interface ContextualState {
|
|
23
|
-
visible: boolean;
|
|
10
|
+
export interface ContextualState extends PopoutState {
|
|
24
11
|
position: Point;
|
|
25
12
|
}
|
|
26
13
|
|
|
@@ -5,25 +5,21 @@ interface ContextualProps {
|
|
|
5
5
|
/** An ID for the root element */
|
|
6
6
|
id?: string;
|
|
7
7
|
/** Classes for the root element */
|
|
8
|
-
class?: ClassValue
|
|
8
|
+
class?: ClassValue;
|
|
9
9
|
/** Styles for the root element */
|
|
10
|
-
style?: StyleValue
|
|
10
|
+
style?: StyleValue;
|
|
11
11
|
/** 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 */
|
|
12
|
-
modal?: boolean
|
|
12
|
+
modal?: boolean;
|
|
13
13
|
/** Whether the contextual is visible */
|
|
14
|
-
visible
|
|
14
|
+
visible: Bindable<boolean | undefined>;
|
|
15
15
|
/** The element to anchor this contextual to, as an alternative to supplying a ContextualTrigger */
|
|
16
|
-
anchor?: HTMLElement
|
|
16
|
+
anchor?: HTMLElement;
|
|
17
17
|
/** The position to display this contextual at */
|
|
18
|
-
position?: Point
|
|
19
|
-
/** A function to be called when the user selects a response */
|
|
20
|
-
callback?: ((value: any) => void),
|
|
21
|
-
/** Raised when this contextual is opened or closed */
|
|
22
|
-
ontoggle?: (open: boolean) => void,
|
|
18
|
+
position?: Point;
|
|
23
19
|
/** Raised when the contextual has opened */
|
|
24
|
-
onopen?: () => void
|
|
20
|
+
onopen?: () => void;
|
|
25
21
|
/** Raised when the contextual has closed */
|
|
26
|
-
onclose?: (result: any) => void
|
|
22
|
+
onclose?: (result: any) => void;
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
/**
|
|
@@ -52,9 +48,9 @@ interface ContextualContentProps {
|
|
|
52
48
|
/** An ID for the root element */
|
|
53
49
|
id?: string;
|
|
54
50
|
/** Classes for the root element */
|
|
55
|
-
class?: ClassValue
|
|
51
|
+
class?: ClassValue;
|
|
56
52
|
/** Styles for the root element */
|
|
57
|
-
style?: StyleValue
|
|
53
|
+
style?: StyleValue;
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
/**
|
|
@@ -71,26 +67,47 @@ declare function ContextualContent(
|
|
|
71
67
|
|
|
72
68
|
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
/**
|
|
71
|
+
* An element that shows a Contextual while hovered at the pointer's
|
|
72
|
+
* location, with proper hover semantics: an intent delay before opening
|
|
73
|
+
* (so passing over the element doesn't flash a window), and an exit grace
|
|
74
|
+
* period after leaving (so moving into the contextual content doesn't close
|
|
75
|
+
* it).
|
|
76
|
+
*
|
|
77
|
+
* Focusing the element opens it immediately; blurring closes it. Use this
|
|
78
|
+
* in place of ContextualTrigger:
|
|
79
|
+
*
|
|
80
|
+
* ```
|
|
81
|
+
* <Contextual>
|
|
82
|
+
* <ContextualHover>Anything can go here</ContextualHover>
|
|
83
|
+
* <ContextualContent />
|
|
84
|
+
* </Contextual>
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare function ContextualHover(
|
|
88
|
+
$parent: ParentNode,
|
|
89
|
+
$anchor: Node | null,
|
|
90
|
+
$props?: ContextualHoverProps,
|
|
91
|
+
$context?: Record<PropertyKey, any>,
|
|
92
|
+
$slots?: Record<string, SlotRender>,
|
|
93
|
+
): void;
|
|
94
|
+
|
|
95
|
+
|
|
84
96
|
|
|
85
97
|
/**
|
|
86
|
-
* The element that causes a Contextual to appear or disappear when
|
|
98
|
+
* The element that causes a Contextual to appear or disappear when
|
|
99
|
+
* right-clicked.
|
|
100
|
+
*
|
|
101
|
+
* For hover activation, use ContextualHover instead -- hover surfaces need
|
|
102
|
+
* an intent delay and an exit grace period that a right-click region
|
|
103
|
+
* doesn't.
|
|
87
104
|
*/
|
|
88
105
|
declare function ContextualTrigger(
|
|
89
106
|
$parent: ParentNode,
|
|
90
107
|
$anchor: Node | null,
|
|
91
|
-
$props
|
|
108
|
+
$props?: ContextualTriggerProps,
|
|
92
109
|
$context?: Record<PropertyKey, any>,
|
|
93
110
|
$slots?: Record<string, SlotRender>,
|
|
94
111
|
): void;
|
|
95
112
|
|
|
96
|
-
export { Contextual, ContextualContent, ContextualTrigger };
|
|
113
|
+
export { Contextual, ContextualContent, ContextualHover, ContextualTrigger };
|
package/dist/Contextual/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
1
|
+
import Contextual from "./Contextual.torp";
|
|
2
|
+
import ContextualContent from "./ContextualContent.torp";
|
|
3
|
+
import ContextualHover from "./ContextualHover.torp";
|
|
4
|
+
import ContextualTrigger from "./ContextualTrigger.torp";
|
|
5
|
+
export { Contextual, ContextualContent, ContextualHover, ContextualTrigger };
|