@krelborn/stylesui 0.8.1 → 0.9.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/README.md +2 -2
- package/dist/accessibility/idSegment.js +1 -2
- package/dist/collections/index.d.ts +3 -0
- package/dist/collections/optionId.js +6 -0
- package/dist/{components/Listbox → collections}/renderedOptions.d.ts +7 -0
- package/dist/{components/Listbox → collections}/renderedOptions.js +6 -4
- package/dist/collections/targetIndexForKey.js +1 -2
- package/dist/collections/typeAhead.js +0 -1
- package/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion.d.ts +90 -0
- package/dist/components/Accordion/Accordion.js +47 -0
- package/dist/components/Accordion/Accordion.module.js +19 -0
- package/dist/components/Accordion/AccordionContext.d.ts +40 -0
- package/dist/components/Accordion/AccordionContext.js +4 -0
- package/dist/components/Accordion/AccordionItem.d.ts +51 -0
- package/dist/components/Accordion/AccordionItem.js +69 -0
- package/dist/components/Accordion/AccordionToggleContent.d.ts +30 -0
- package/dist/components/Accordion/AccordionToggleContent.js +44 -0
- package/dist/components/Accordion/accordionIds.d.ts +24 -0
- package/dist/components/Accordion/accordionIds.js +12 -0
- package/dist/components/Accordion/index.d.ts +4 -0
- package/dist/components/Accordion/useAccordionContext.d.ts +9 -0
- package/dist/components/Accordion/useAccordionContext.js +10 -0
- package/dist/components/Accordion/useFindablePanel.d.ts +25 -0
- package/dist/components/Accordion/useFindablePanel.js +36 -0
- package/dist/components/Accordion/useFragmentTargetReveal.d.ts +27 -0
- package/dist/components/Accordion/useFragmentTargetReveal.js +36 -0
- package/dist/components/Accordion/useHasOpened.d.ts +7 -0
- package/dist/components/Accordion/useHasOpened.js +7 -0
- package/dist/components/Alert/Alert.js +1 -2
- package/dist/components/Alert/Alert.module.js +1 -2
- package/dist/components/Alert/AlertIcon.js +1 -2
- package/dist/components/Avatar/Avatar.js +1 -2
- package/dist/components/Avatar/Avatar.module.js +1 -2
- package/dist/components/Avatar/initialsOf.js +1 -2
- package/dist/components/AvatarGroup/AvatarGroup.js +1 -2
- package/dist/components/AvatarGroup/AvatarGroup.module.js +1 -2
- package/dist/components/Badge/Badge.js +1 -2
- package/dist/components/Badge/Badge.module.js +1 -2
- package/dist/components/Box/Box.js +1 -2
- package/dist/components/Box/Box.module.js +1 -2
- package/dist/components/Button/Button.js +2 -7
- package/dist/components/Button/Button.module.js +1 -2
- package/dist/components/Card/Card.js +1 -2
- package/dist/components/Card/Card.module.js +1 -2
- package/dist/components/Center/Center.js +6 -7
- package/dist/components/Center/Center.module.js +1 -2
- package/dist/components/Checkbox/Checkbox.js +1 -2
- package/dist/components/ChoiceControl/ChoiceControl.js +1 -2
- package/dist/components/ChoiceControl/ChoiceControl.module.js +1 -2
- package/dist/components/Cluster/Cluster.js +1 -2
- package/dist/components/Code/Code.js +1 -2
- package/dist/components/Code/Code.module.js +1 -2
- package/dist/components/Combobox/Autocomplete.d.ts +83 -0
- package/dist/components/Combobox/Autocomplete.js +102 -0
- package/dist/components/Combobox/Combobox.css +1 -0
- package/dist/components/Combobox/Combobox.d.ts +59 -0
- package/dist/components/Combobox/Combobox.js +82 -0
- package/dist/components/Combobox/Combobox.module.js +17 -0
- package/dist/components/Combobox/ComboboxContext.d.ts +88 -0
- package/dist/components/Combobox/ComboboxContext.js +4 -0
- package/dist/components/Combobox/ComboboxFieldValue.d.ts +17 -0
- package/dist/components/Combobox/ComboboxFieldValue.js +33 -0
- package/dist/components/Combobox/ComboboxOption.d.ts +51 -0
- package/dist/components/Combobox/ComboboxOption.js +74 -0
- package/dist/components/Combobox/ComboboxOptionContent.d.ts +32 -0
- package/dist/components/Combobox/ComboboxOptionContent.js +51 -0
- package/dist/components/Combobox/ComboboxPopup.d.ts +50 -0
- package/dist/components/Combobox/ComboboxPopup.js +59 -0
- package/dist/components/Combobox/autocompleteKeys.d.ts +31 -0
- package/dist/components/Combobox/autocompleteKeys.js +25 -0
- package/dist/components/Combobox/comboboxKeys.d.ts +10 -0
- package/dist/components/Combobox/comboboxKeys.js +22 -0
- package/dist/components/Combobox/containsText.d.ts +9 -0
- package/dist/components/Combobox/containsText.js +8 -0
- package/dist/components/Combobox/index.d.ts +6 -0
- package/dist/components/Combobox/isAltArrow.d.ts +9 -0
- package/dist/components/Combobox/isAltArrow.js +5 -0
- package/dist/components/Combobox/isOptionShown.d.ts +10 -0
- package/dist/components/Combobox/isOptionShown.js +5 -0
- package/dist/components/Combobox/useAutocompleteText.d.ts +56 -0
- package/dist/components/Combobox/useAutocompleteText.js +27 -0
- package/dist/components/Combobox/useComboboxContext.d.ts +9 -0
- package/dist/components/Combobox/useComboboxContext.js +10 -0
- package/dist/components/Combobox/useComboboxList.d.ts +129 -0
- package/dist/components/Combobox/useComboboxList.js +138 -0
- package/dist/components/Combobox/useComboboxOption.d.ts +35 -0
- package/dist/components/Combobox/useComboboxOption.js +46 -0
- package/dist/components/Combobox/useComboboxSelection.d.ts +45 -0
- package/dist/components/Combobox/useComboboxSelection.js +17 -0
- package/dist/components/Combobox/useResultsAnnouncement.d.ts +23 -0
- package/dist/components/Combobox/useResultsAnnouncement.js +24 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/useContextMenu.d.ts +112 -0
- package/dist/components/ContextMenu/useContextMenu.js +202 -0
- package/dist/components/ContextMenu/watchLongPress.d.ts +35 -0
- package/dist/components/ContextMenu/watchLongPress.js +38 -0
- package/dist/components/Counter/Counter.js +5 -6
- package/dist/components/Counter/Counter.module.js +1 -2
- package/dist/components/Cover/Cover.js +8 -9
- package/dist/components/Cover/Cover.module.js +1 -2
- package/dist/components/Divider/Divider.js +1 -2
- package/dist/components/Divider/Divider.module.js +1 -2
- package/dist/components/Field/Field.js +11 -10
- package/dist/components/Field/Field.module.js +1 -2
- package/dist/components/Fieldset/Fieldset.js +1 -2
- package/dist/components/Fieldset/Fieldset.module.js +1 -2
- package/dist/components/Frame/Frame.js +5 -6
- package/dist/components/Frame/Frame.module.js +1 -2
- package/dist/components/Grid/Grid.js +9 -10
- package/dist/components/Grid/Grid.module.js +1 -2
- package/dist/components/Heading/Heading.js +1 -2
- package/dist/components/Heading/Heading.module.js +1 -2
- package/dist/components/HorizontalFlow/HorizontalFlow.js +6 -7
- package/dist/components/HorizontalFlow/HorizontalFlow.module.js +1 -2
- package/dist/components/Icon/AddIcon.js +1 -2
- package/dist/components/Icon/CheckIcon.d.ts +11 -0
- package/dist/components/Icon/CheckIcon.js +18 -0
- package/dist/components/Icon/ChevronDownIcon.js +1 -2
- package/dist/components/Icon/ChevronRightIcon.d.ts +11 -0
- package/dist/components/Icon/ChevronRightIcon.js +19 -0
- package/dist/components/Icon/CloseIcon.js +1 -2
- package/dist/components/Icon/ColorModeIcon.js +1 -2
- package/dist/components/Icon/DeleteIcon.js +1 -2
- package/dist/components/Icon/Icon.js +1 -2
- package/dist/components/Icon/Icon.module.js +1 -2
- package/dist/components/Icon/InfoIcon.js +1 -2
- package/dist/components/Icon/MenuIcon.d.ts +12 -0
- package/dist/components/Icon/MenuIcon.js +28 -0
- package/dist/components/Icon/MoreHorizontalIcon.js +1 -2
- package/dist/components/Icon/MoreVerticalIcon.js +1 -2
- package/dist/components/Icon/PaletteIcon.js +1 -2
- package/dist/components/Icon/RefreshIcon.js +1 -2
- package/dist/components/Icon/RemoveIcon.js +1 -2
- package/dist/components/Icon/SendIcon.js +1 -2
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/IconButton/IconButton.js +1 -2
- package/dist/components/IconButton/IconButton.module.js +1 -2
- package/dist/components/Kbd/Kbd.js +1 -2
- package/dist/components/Kbd/Kbd.module.js +1 -2
- package/dist/components/Link/Link.js +1 -2
- package/dist/components/Link/Link.module.js +1 -2
- package/dist/components/Listbox/Listbox.js +9 -10
- package/dist/components/Listbox/Listbox.module.js +1 -2
- package/dist/components/Listbox/ListboxContext.js +1 -2
- package/dist/components/Listbox/ListboxOption.js +7 -8
- package/dist/components/Listbox/useListbox.js +22 -23
- package/dist/components/Listbox/useListboxContext.js +1 -2
- package/dist/components/Menu/Menu.d.ts +70 -0
- package/dist/components/Menu/Menu.js +76 -0
- package/dist/components/Menu/MenuContext.d.ts +29 -0
- package/dist/components/Menu/MenuContext.js +4 -0
- package/dist/components/Menu/MenuGroup.d.ts +22 -0
- package/dist/components/Menu/MenuGroup.js +32 -0
- package/dist/components/Menu/MenuItem.d.ts +77 -0
- package/dist/components/Menu/MenuItem.js +54 -0
- package/dist/components/Menu/MenuItemCheckbox.d.ts +61 -0
- package/dist/components/Menu/MenuItemCheckbox.js +37 -0
- package/dist/components/Menu/MenuItemRadio.d.ts +47 -0
- package/dist/components/Menu/MenuItemRadio.js +39 -0
- package/dist/components/Menu/MenuRadioGroup.d.ts +34 -0
- package/dist/components/Menu/MenuRadioGroup.js +27 -0
- package/dist/components/Menu/MenuRadioGroupContext.d.ts +17 -0
- package/dist/components/Menu/MenuRadioGroupContext.js +4 -0
- package/dist/components/Menu/MenuSeparator.d.ts +16 -0
- package/dist/components/Menu/MenuSeparator.js +20 -0
- package/dist/components/Menu/Submenu.d.ts +36 -0
- package/dist/components/Menu/Submenu.js +122 -0
- package/dist/components/Menu/index.d.ts +18 -0
- package/dist/components/Menu/useMenu.d.ts +18 -0
- package/dist/components/Menu/useMenu.js +20 -0
- package/dist/components/Menu/useMenuButton.d.ts +124 -0
- package/dist/components/Menu/useMenuButton.js +92 -0
- package/dist/components/Menu/useMenuContext.d.ts +9 -0
- package/dist/components/Menu/useMenuContext.js +10 -0
- package/dist/components/Menu/useMenuItemContent.d.ts +55 -0
- package/dist/components/Menu/useMenuItemContent.js +66 -0
- package/dist/components/Menu/useMenuPointer.d.ts +27 -0
- package/dist/components/Menu/useMenuPointer.js +56 -0
- package/dist/components/Menu/useMenuRadioGroupContext.d.ts +9 -0
- package/dist/components/Menu/useMenuRadioGroupContext.js +10 -0
- package/dist/components/MenuSurface/MenuSurface.css +1 -0
- package/dist/components/MenuSurface/MenuSurface.module.js +16 -0
- package/dist/components/Menubar/Menubar.css +1 -0
- package/dist/components/Menubar/Menubar.d.ts +23 -0
- package/dist/components/Menubar/Menubar.js +67 -0
- package/dist/components/Menubar/Menubar.module.js +7 -0
- package/dist/components/Menubar/MenubarContext.d.ts +29 -0
- package/dist/components/Menubar/MenubarContext.js +4 -0
- package/dist/components/Menubar/MenubarMenu.d.ts +26 -0
- package/dist/components/Menubar/MenubarMenu.js +88 -0
- package/dist/components/Menubar/findOpenMenubarItem.d.ts +7 -0
- package/dist/components/Menubar/findOpenMenubarItem.js +6 -0
- package/dist/components/Menubar/index.d.ts +4 -0
- package/dist/components/Menubar/menubarItems.d.ts +7 -0
- package/dist/components/Menubar/menubarItems.js +5 -0
- package/dist/components/Menubar/useMenubarContext.d.ts +9 -0
- package/dist/components/Menubar/useMenubarContext.js +10 -0
- package/dist/components/NavBar/NavBar.css +1 -0
- package/dist/components/NavBar/NavBar.d.ts +53 -0
- package/dist/components/NavBar/NavBar.js +97 -0
- package/dist/components/NavBar/NavBar.module.js +22 -0
- package/dist/components/NavBar/NavBarContext.d.ts +21 -0
- package/dist/components/NavBar/NavBarContext.js +4 -0
- package/dist/components/NavBar/NavBarItem.d.ts +32 -0
- package/dist/components/NavBar/NavBarItem.js +18 -0
- package/dist/components/NavBar/NavBarMenu.d.ts +32 -0
- package/dist/components/NavBar/NavBarMenu.js +84 -0
- package/dist/components/NavBar/NavBarMenuGroup.d.ts +25 -0
- package/dist/components/NavBar/NavBarMenuGroup.js +40 -0
- package/dist/components/NavBar/NavBarMenuItem.d.ts +36 -0
- package/dist/components/NavBar/NavBarMenuItem.js +49 -0
- package/dist/components/NavBar/index.d.ts +10 -0
- package/dist/components/NavBar/isNavBarCollapsed.d.ts +8 -0
- package/dist/components/NavBar/isNavBarCollapsed.js +5 -0
- package/dist/components/NavBar/leavesPageInPlace.d.ts +12 -0
- package/dist/components/NavBar/leavesPageInPlace.js +29 -0
- package/dist/components/NavBar/renderNavBarLink.d.ts +12 -0
- package/dist/components/NavBar/renderNavBarLink.js +16 -0
- package/dist/components/NavBar/useLayoutSwitch.d.ts +26 -0
- package/dist/components/NavBar/useLayoutSwitch.js +25 -0
- package/dist/components/NavBar/useNavBarContext.d.ts +9 -0
- package/dist/components/NavBar/useNavBarContext.js +10 -0
- package/dist/components/NavList/NavList.js +1 -2
- package/dist/components/NavList/NavList.module.js +1 -2
- package/dist/components/NavList/NavListGroup.js +1 -2
- package/dist/components/NavList/NavListItem.d.ts +4 -8
- package/dist/components/NavList/NavListItem.js +1 -2
- package/dist/components/Overlay/Overlay.js +6 -7
- package/dist/components/Overlay/Overlay.module.js +1 -2
- package/dist/components/PageLayout/PageLayout.js +6 -7
- package/dist/components/PageLayout/PageLayout.module.js +1 -2
- package/dist/components/Popover/Popover.js +1 -2
- package/dist/components/Popover/Popover.module.js +1 -2
- package/dist/components/Popover/usePopover.js +44 -39
- package/dist/components/Prose/Prose.js +1 -2
- package/dist/components/Prose/Prose.module.js +1 -2
- package/dist/components/Radio/Radio.js +1 -2
- package/dist/components/RadioGroup/RadioGroup.js +5 -6
- package/dist/components/RadioGroup/RadioGroup.module.js +1 -2
- package/dist/components/RequiredIndicator/RequiredIndicator.js +1 -2
- package/dist/components/RequiredIndicator/RequiredIndicator.module.js +1 -2
- package/dist/components/Row/Row.js +1 -2
- package/dist/components/SegmentedControl/Segment.js +1 -2
- package/dist/components/SegmentedControl/SegmentedControl.js +1 -2
- package/dist/components/SegmentedControl/SegmentedControl.module.js +1 -2
- package/dist/components/Select/Select.js +1 -2
- package/dist/components/Sidebar/Sidebar.js +7 -8
- package/dist/components/Sidebar/Sidebar.module.js +1 -2
- package/dist/components/SkipLink/SkipLink.js +1 -2
- package/dist/components/SkipLink/SkipLink.module.js +1 -2
- package/dist/components/Spinner/Spinner.js +1 -2
- package/dist/components/Spinner/Spinner.module.js +1 -2
- package/dist/components/Stack/Stack.js +8 -9
- package/dist/components/Stack/Stack.module.js +1 -2
- package/dist/components/StatusDot/StatusDot.js +1 -2
- package/dist/components/StatusDot/StatusDot.module.js +1 -2
- package/dist/components/Switch/Switch.js +1 -2
- package/dist/components/Switcher/Switcher.js +9 -10
- package/dist/components/Switcher/Switcher.module.js +1 -2
- package/dist/components/Tabs/Tab.js +12 -13
- package/dist/components/Tabs/TabList.js +1 -2
- package/dist/components/Tabs/TabPanel.js +1 -2
- package/dist/components/Tabs/Tabs.js +1 -2
- package/dist/components/Tabs/Tabs.module.js +1 -2
- package/dist/components/Tabs/TabsContext.js +1 -2
- package/dist/components/Tabs/tabIds.js +1 -2
- package/dist/components/Tabs/useTabsContext.js +1 -2
- package/dist/components/Text/Text.js +1 -2
- package/dist/components/Text/Text.module.js +1 -2
- package/dist/components/TextControl/TextControl.d.ts +3 -3
- package/dist/components/TextControl/TextControl.js +14 -10
- package/dist/components/TextControl/TextControl.module.js +1 -2
- package/dist/components/TextInput/TextInput.js +1 -2
- package/dist/components/Textarea/Textarea.js +1 -2
- package/dist/components/Theme/Theme.js +1 -2
- package/dist/components/Tooltip/Tooltip.js +1 -2
- package/dist/components/Tooltip/Tooltip.module.js +1 -2
- package/dist/components/Tooltip/tooltipCoordinator.js +1 -2
- package/dist/components/Tooltip/useTooltip.js +1 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -2
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js +1 -2
- package/dist/errors/MissingContextError.js +1 -2
- package/dist/errors/PopoverRefusedError.js +1 -2
- package/dist/forms/FieldContext.d.ts +5 -0
- package/dist/forms/FieldContext.js +1 -2
- package/dist/forms/RadioGroupContext.js +1 -2
- package/dist/forms/hasContent.js +1 -2
- package/dist/forms/useFieldControl.js +1 -2
- package/dist/forms/useRadioGroupItem.js +1 -2
- package/dist/index.d.ts +13 -1
- package/dist/index.js +90 -65
- package/dist/layout/listRole.js +1 -2
- package/dist/layout/spaceValue.js +1 -2
- package/dist/layout/withCustomProperties.js +1 -2
- package/dist/links/LinkOrButtonProps.d.ts +17 -0
- package/dist/links/index.d.ts +1 -0
- package/dist/menus/closeWhenFocusLeaves.d.ts +9 -0
- package/dist/menus/closeWhenFocusLeaves.js +11 -0
- package/dist/menus/focusItem.d.ts +6 -0
- package/dist/menus/focusItem.js +9 -0
- package/dist/menus/focusOnOpening.d.ts +11 -0
- package/dist/menus/focusOnOpening.js +11 -0
- package/dist/menus/hasModifier.d.ts +7 -0
- package/dist/menus/hasModifier.js +5 -0
- package/dist/menus/index.d.ts +11 -0
- package/dist/menus/itemText.d.ts +8 -0
- package/dist/menus/itemText.js +6 -0
- package/dist/menus/leaveMenuOnTab.d.ts +9 -0
- package/dist/menus/leaveMenuOnTab.js +6 -0
- package/dist/menus/pointerIntent.d.ts +36 -0
- package/dist/menus/pointerIntent.js +68 -0
- package/dist/menus/renderedItems.d.ts +8 -0
- package/dist/menus/renderedItems.js +4 -0
- package/dist/menus/watchRemovals.d.ts +8 -0
- package/dist/menus/watchRemovals.js +23 -0
- package/dist/overlays/anchorNameFor.js +1 -2
- package/dist/overlays/mergeProps.js +1 -2
- package/dist/overlays/syncPopover.js +1 -2
- package/dist/overlays/useOverlay.js +2 -9
- package/package.json +10 -10
- package/dist/components/Listbox/optionId.js +0 -7
- /package/dist/{components/Listbox → collections}/optionId.d.ts +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { c as r } from "react/compiler-runtime";
|
|
3
|
+
// src/components/Combobox/useResultsAnnouncement.ts
|
|
4
|
+
var i = 500;
|
|
5
|
+
function a(a, o, s) {
|
|
6
|
+
let c = r(11), [l, u] = n(""), d = t(void 0), f, p;
|
|
7
|
+
c[0] === Symbol.for("react.memo_cache_sentinel") ? (f = () => () => clearTimeout(d.current), p = [], c[0] = f, c[1] = p) : (f = c[0], p = c[1]), e(f, p);
|
|
8
|
+
let m, h;
|
|
9
|
+
c[2] === s ? (m = c[3], h = c[4]) : (m = () => {
|
|
10
|
+
s || clearTimeout(d.current);
|
|
11
|
+
}, h = [s], c[2] = s, c[3] = m, c[4] = h), e(m, h);
|
|
12
|
+
let g;
|
|
13
|
+
c[5] !== o || c[6] !== a ? (g = function() {
|
|
14
|
+
u(""), clearTimeout(d.current), d.current = setTimeout(() => {
|
|
15
|
+
u(a(o()));
|
|
16
|
+
}, i);
|
|
17
|
+
}, c[5] = o, c[6] = a, c[7] = g) : g = c[7];
|
|
18
|
+
let _ = g, v;
|
|
19
|
+
return c[8] !== _ || c[9] !== l ? (v = {
|
|
20
|
+
announceCount: _,
|
|
21
|
+
announcement: l
|
|
22
|
+
}, c[8] = _, c[9] = l, c[10] = v) : v = c[10], v;
|
|
23
|
+
}
|
|
24
|
+
export { a as useResultsAnnouncement };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { CSSProperties, FocusEvent, KeyboardEvent, MouseEvent, PointerEvent } from "react";
|
|
2
|
+
import type { RequiredAccessibleName } from "../../accessibility";
|
|
3
|
+
import type { MenuOverlayProps } from "../Menu/Menu";
|
|
4
|
+
/**
|
|
5
|
+
* Options for `useContextMenu`
|
|
6
|
+
*/
|
|
7
|
+
export interface UseContextMenuOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Called with the new open state when the menu opens or closes
|
|
10
|
+
*/
|
|
11
|
+
onOpenChange?: (open: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props `getTargetProps` sets on the region
|
|
15
|
+
*/
|
|
16
|
+
interface ContextMenuTargetProps {
|
|
17
|
+
/**
|
|
18
|
+
* Marks the region, so a region inside it handles its own events
|
|
19
|
+
*/
|
|
20
|
+
"data-context-menu-region": "";
|
|
21
|
+
/**
|
|
22
|
+
* Opens the menu at the pointer, or at the focused element when no pointer sent the event
|
|
23
|
+
*/
|
|
24
|
+
onContextMenu: (event: MouseEvent<HTMLElement>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Opens the menu at the focused element on Shift+F10 or the ContextMenu key
|
|
27
|
+
*/
|
|
28
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Notes the pointer pressing in the region, which the menu holds while the press that opened it lasts, and opens the
|
|
31
|
+
* menu on a touch held in place
|
|
32
|
+
*/
|
|
33
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Names the region as the menu's anchor, and stops iOS showing its callout on a held link or image
|
|
36
|
+
*/
|
|
37
|
+
style: CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Props `getMenuProps` sets on the `Menu`
|
|
41
|
+
*/
|
|
42
|
+
interface ContextMenuOverlayProps extends MenuOverlayProps {
|
|
43
|
+
/**
|
|
44
|
+
* Places the menu at the point it opened at rather than beside the region
|
|
45
|
+
*/
|
|
46
|
+
"data-context-menu": "";
|
|
47
|
+
/**
|
|
48
|
+
* Closes the menu when focus leaves it
|
|
49
|
+
*/
|
|
50
|
+
onBlur: (event: FocusEvent<HTMLElement>) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Keeps the browser's menu from opening over the menu
|
|
53
|
+
*/
|
|
54
|
+
onContextMenu: (event: MouseEvent<HTMLElement>) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Closes the menu on Tab, returning focus to where it opened from
|
|
57
|
+
*/
|
|
58
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* The point's distances from each edge of the region
|
|
61
|
+
*/
|
|
62
|
+
style: CSSProperties;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Prop getters for the region a context menu opens in and its `Menu`, whether it is open, what it opened for, and a
|
|
66
|
+
* way to close it
|
|
67
|
+
*/
|
|
68
|
+
export interface UseContextMenuResult {
|
|
69
|
+
/**
|
|
70
|
+
* Closes the menu, returning focus to where it opened from as choosing an item does, and reports `false` through
|
|
71
|
+
* `onOpenChange`
|
|
72
|
+
*/
|
|
73
|
+
close: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the props to spread on the `Menu`, merged with the given ones, which must name the menu with `aria-label`
|
|
76
|
+
* or `aria-labelledby`, since no trigger names it
|
|
77
|
+
*/
|
|
78
|
+
getMenuProps: <Props extends object>(props: Props & RequiredAccessibleName & Partial<ContextMenuOverlayProps>) => Omit<Props, keyof ContextMenuOverlayProps> & ContextMenuOverlayProps;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the props to spread on the region the menu opens in, merged with any given: where both set a handler, both
|
|
81
|
+
* run, the given one first, and `style` objects merge. Give the region's own `style` here rather than after the
|
|
82
|
+
* spread, which would drop the anchor name the menu is placed by.
|
|
83
|
+
*/
|
|
84
|
+
getTargetProps: <Props extends object>(props?: Props & Partial<ContextMenuTargetProps>) => Omit<Props, keyof ContextMenuTargetProps> & ContextMenuTargetProps;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the menu is open
|
|
87
|
+
*/
|
|
88
|
+
open: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* The element the menu last opened for, such as the one under the pointer; `null` until it first opens
|
|
91
|
+
*/
|
|
92
|
+
target: Element | null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Connects a `Menu` to a region, such as a list of files or a canvas, so a right-click in the region opens the menu at
|
|
96
|
+
* the pointer, with focus on the menu itself, and the next Down or Up moves to the first or last item. Shift+F10 or the
|
|
97
|
+
* ContextMenu key opens it below the focused element, with focus on its first item, and a touch held for half a second
|
|
98
|
+
* opens it at the touch, as a right-click does. Choosing an item, Escape, Tab or a click outside closes it, and focus
|
|
99
|
+
* goes back to the element in the region that had it when it opened, unless a click outside put it elsewhere. `target`
|
|
100
|
+
* tells which element the menu opened for, so one menu can serve every row.
|
|
101
|
+
*
|
|
102
|
+
* @param options the change callback
|
|
103
|
+
* @returns prop getters for the region and the `Menu`, whether it is open, what it opened for, and `close`
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const contextMenu = useContextMenu();
|
|
107
|
+
*
|
|
108
|
+
* <ul {...contextMenu.getTargetProps()} aria-label="Files">…</ul>
|
|
109
|
+
* <Menu {...contextMenu.getMenuProps({ "aria-label": "File actions" })}>…</Menu>
|
|
110
|
+
*/
|
|
111
|
+
export declare function useContextMenu({ onOpenChange }?: UseContextMenuOptions): UseContextMenuResult;
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { closeWhenFocusLeaves as e } from "../../menus/closeWhenFocusLeaves.js";
|
|
2
|
+
import { focusOnOpening as t } from "../../menus/focusOnOpening.js";
|
|
3
|
+
import { hasModifier as n } from "../../menus/hasModifier.js";
|
|
4
|
+
import { leaveMenuOnTab as r } from "../../menus/leaveMenuOnTab.js";
|
|
5
|
+
import { watchRemovals as i } from "../../menus/watchRemovals.js";
|
|
6
|
+
import { mergeProps as a } from "../../overlays/mergeProps.js";
|
|
7
|
+
import { syncPopover as o } from "../../overlays/syncPopover.js";
|
|
8
|
+
import { usePopover as s } from "../Popover/usePopover.js";
|
|
9
|
+
import { watchLongPress as c } from "./watchLongPress.js";
|
|
10
|
+
import { useEffect as l, useRef as u, useState as d } from "react";
|
|
11
|
+
// src/components/ContextMenu/useContextMenu.ts
|
|
12
|
+
function f({ onOpenChange: f } = {}) {
|
|
13
|
+
let h = s({
|
|
14
|
+
onOpenChange: f,
|
|
15
|
+
placement: "bottom-start"
|
|
16
|
+
}), [S, C] = d(null), w = u("menu"), T = u(null), E = u(!1), D = u(!1), O = u(null), k = u(null), A = u(!1), j = u(null), M = u(!1), { anchorName: N, id: P } = h.getOverlayProps();
|
|
17
|
+
l(() => () => {
|
|
18
|
+
O.current?.(), B();
|
|
19
|
+
}, []), l(() => {
|
|
20
|
+
let e = S?.page.getElementById(P);
|
|
21
|
+
if (S === null || e == null) return;
|
|
22
|
+
let n;
|
|
23
|
+
return e.matches(":popover-open") ? t(e, S.focus) : (w.current = S.focus, n = o(e, !0)), S.pressingPointer !== null && y(e, S.pressingPointer), n;
|
|
24
|
+
}, [P, S]);
|
|
25
|
+
function F(e) {
|
|
26
|
+
if (!I(e) || (B(), p(e)) || (e.preventDefault(), L(e.nativeEvent))) return;
|
|
27
|
+
if (m(e.nativeEvent)) {
|
|
28
|
+
z(e.currentTarget, e.target);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let t = e.buttons === 0 ? null : k.current, n = {
|
|
32
|
+
bottom: e.clientY,
|
|
33
|
+
top: e.clientY,
|
|
34
|
+
x: e.clientX
|
|
35
|
+
};
|
|
36
|
+
H(e.currentTarget, e.target, n, "menu", t);
|
|
37
|
+
}
|
|
38
|
+
function I(e) {
|
|
39
|
+
let t = e.target.closest("[data-context-menu-region], [role=\"menu\"]");
|
|
40
|
+
return t === null || t === e.currentTarget;
|
|
41
|
+
}
|
|
42
|
+
function L(e) {
|
|
43
|
+
let t = e.pointerType;
|
|
44
|
+
return t === "touch" && M.current || t === "" && A.current;
|
|
45
|
+
}
|
|
46
|
+
function R(e) {
|
|
47
|
+
!(e.key === "ContextMenu" || e.key === "F10" && e.shiftKey) || !I(e) || e.defaultPrevented || n(e) || g(e.target) || (e.preventDefault(), z(e.currentTarget, e.target), A.current = !0);
|
|
48
|
+
}
|
|
49
|
+
function z(e, t) {
|
|
50
|
+
let n = e.ownerDocument, r = n.defaultView, i = t.getBoundingClientRect(), a = r?.getComputedStyle(n.getElementById(P) ?? t).direction === "rtl", o = r?.innerWidth ?? i.right, s = r?.innerHeight ?? i.bottom;
|
|
51
|
+
H(e, t, {
|
|
52
|
+
bottom: _(i.top, s),
|
|
53
|
+
top: _(i.bottom, s),
|
|
54
|
+
x: _(a ? i.right : i.left, o)
|
|
55
|
+
}, "first", null);
|
|
56
|
+
}
|
|
57
|
+
function B() {
|
|
58
|
+
j.current?.(), j.current = null;
|
|
59
|
+
}
|
|
60
|
+
function V(e) {
|
|
61
|
+
if (k.current = e.pointerId, e.pointerType !== "touch" || j.current !== null || !I(e) || g(e.target)) return;
|
|
62
|
+
let t = e.currentTarget, n = e.target, { clientX: r, clientY: i, pointerId: a } = e;
|
|
63
|
+
M.current = !1, j.current = c({
|
|
64
|
+
clientX: r,
|
|
65
|
+
clientY: i,
|
|
66
|
+
pointerId: a
|
|
67
|
+
}, t.ownerDocument, {
|
|
68
|
+
onEnd: () => {
|
|
69
|
+
j.current = null;
|
|
70
|
+
},
|
|
71
|
+
onLongPress: () => {
|
|
72
|
+
M.current = !0, H(t, n, {
|
|
73
|
+
bottom: i,
|
|
74
|
+
top: i,
|
|
75
|
+
x: r
|
|
76
|
+
}, "menu", a);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function H(e, t, n, r, i) {
|
|
81
|
+
let a = e.ownerDocument, o = a.getElementById(P), s = a.activeElement, c = e.getBoundingClientRect();
|
|
82
|
+
A.current = !1, D.current = !1, s !== null && e.contains(s) && o?.contains(s) !== !0 ? T.current = s : o?.matches(":popover-open") !== !0 && (T.current = null), C({
|
|
83
|
+
focus: r,
|
|
84
|
+
offsets: {
|
|
85
|
+
bottom: c.bottom - n.bottom,
|
|
86
|
+
left: n.x - c.left,
|
|
87
|
+
right: c.right - n.x,
|
|
88
|
+
top: n.top - c.top
|
|
89
|
+
},
|
|
90
|
+
page: a,
|
|
91
|
+
pressingPointer: i,
|
|
92
|
+
target: t
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function U(e) {
|
|
96
|
+
let t = e.currentTarget;
|
|
97
|
+
e.target === t && e.newState === "closed" && (E.current = t.contains(t.ownerDocument.activeElement) || D.current && x(t.ownerDocument), D.current = !1);
|
|
98
|
+
}
|
|
99
|
+
function W(e) {
|
|
100
|
+
let n = e.currentTarget;
|
|
101
|
+
e.target === n && (O.current?.(), O.current = null, e.newState === "open" ? (O.current = i(n), t(n, w.current)) : (A.current = !1, E.current && (E.current = !1, b(n, T.current))));
|
|
102
|
+
}
|
|
103
|
+
function G(e) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
}
|
|
106
|
+
function K(e) {
|
|
107
|
+
r(e, T.current, J);
|
|
108
|
+
}
|
|
109
|
+
function q(t) {
|
|
110
|
+
e(t.currentTarget, t.relatedTarget, () => !1);
|
|
111
|
+
}
|
|
112
|
+
function J() {
|
|
113
|
+
h.open && (D.current = !0), h.close();
|
|
114
|
+
}
|
|
115
|
+
function Y(e) {
|
|
116
|
+
let t = a(e, {
|
|
117
|
+
close: J,
|
|
118
|
+
"data-context-menu": "",
|
|
119
|
+
onBeforeToggle: U,
|
|
120
|
+
onBlur: q,
|
|
121
|
+
onContextMenu: G,
|
|
122
|
+
onKeyDown: K,
|
|
123
|
+
onToggle: W,
|
|
124
|
+
style: v(S?.offsets)
|
|
125
|
+
});
|
|
126
|
+
return h.getOverlayProps(t);
|
|
127
|
+
}
|
|
128
|
+
function X(e) {
|
|
129
|
+
return a(e, {
|
|
130
|
+
"data-context-menu-region": "",
|
|
131
|
+
onContextMenu: F,
|
|
132
|
+
onKeyDown: R,
|
|
133
|
+
onPointerDown: V,
|
|
134
|
+
style: {
|
|
135
|
+
anchorName: N,
|
|
136
|
+
WebkitTouchCallout: "none"
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
close: J,
|
|
142
|
+
getMenuProps: Y,
|
|
143
|
+
getTargetProps: X,
|
|
144
|
+
open: h.open,
|
|
145
|
+
target: S?.target ?? null
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function p(e) {
|
|
149
|
+
return e.defaultPrevented || g(e.target) || e.shiftKey && !m(e.nativeEvent);
|
|
150
|
+
}
|
|
151
|
+
function m(e) {
|
|
152
|
+
return "pointerType" in e && e.pointerType === "";
|
|
153
|
+
}
|
|
154
|
+
var h = /* @__PURE__ */ new Set([
|
|
155
|
+
"button",
|
|
156
|
+
"checkbox",
|
|
157
|
+
"color",
|
|
158
|
+
"file",
|
|
159
|
+
"hidden",
|
|
160
|
+
"image",
|
|
161
|
+
"radio",
|
|
162
|
+
"range",
|
|
163
|
+
"reset",
|
|
164
|
+
"submit"
|
|
165
|
+
]);
|
|
166
|
+
function g(e) {
|
|
167
|
+
let t = e;
|
|
168
|
+
switch (t?.tagName) {
|
|
169
|
+
case "INPUT": return !h.has(t.type);
|
|
170
|
+
case "SELECT":
|
|
171
|
+
case "TEXTAREA": return !0;
|
|
172
|
+
default: {
|
|
173
|
+
let e = t?.closest("[contenteditable]") ?? null;
|
|
174
|
+
return e !== null && e.getAttribute("contenteditable") !== "false";
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function _(e, t) {
|
|
179
|
+
return Math.min(Math.max(e, 0), t);
|
|
180
|
+
}
|
|
181
|
+
function v(e) {
|
|
182
|
+
return e === void 0 ? {} : {
|
|
183
|
+
"--_sui-context-menu-bottom": `${e.bottom}px`,
|
|
184
|
+
"--_sui-context-menu-left": `${e.left}px`,
|
|
185
|
+
"--_sui-context-menu-right": `${e.right}px`,
|
|
186
|
+
"--_sui-context-menu-top": `${e.top}px`
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function y(e, t) {
|
|
190
|
+
try {
|
|
191
|
+
e.setPointerCapture(t);
|
|
192
|
+
} catch (e) {
|
|
193
|
+
if (e?.name !== "NotFoundError") throw e;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function b(e, t) {
|
|
197
|
+
(x(e.ownerDocument) || e.contains(e.ownerDocument.activeElement)) && t?.focus();
|
|
198
|
+
}
|
|
199
|
+
function x(e) {
|
|
200
|
+
return e.activeElement === null || e.activeElement === e.body;
|
|
201
|
+
}
|
|
202
|
+
export { f as useContextMenu };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The touch that started a press
|
|
3
|
+
*/
|
|
4
|
+
interface Press {
|
|
5
|
+
clientX: number;
|
|
6
|
+
clientY: number;
|
|
7
|
+
pointerId: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Callbacks for the end of a long-press
|
|
11
|
+
*/
|
|
12
|
+
interface LongPressCallbacks {
|
|
13
|
+
/**
|
|
14
|
+
* Called when the press ends, however it ends
|
|
15
|
+
*/
|
|
16
|
+
onEnd: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Called once the touch has been held long enough
|
|
19
|
+
*/
|
|
20
|
+
onLongPress: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Watches a touch press for being held in place long enough to open a context menu. Moving further than the tolerance,
|
|
24
|
+
* lifting the finger, the browser cancelling the touch, as it does when a scroll starts, and a second finger all stop
|
|
25
|
+
* it opening. Until the press ends, text selection is stopped, which iOS would start on held text, and a press held
|
|
26
|
+
* long enough ends without the mouse events and click browsers send after a touch, which would act on the element
|
|
27
|
+
* under the finger and move focus out of the menu.
|
|
28
|
+
*
|
|
29
|
+
* @param press the `pointerdown` of the touch
|
|
30
|
+
* @param page the document the touch is in
|
|
31
|
+
* @param callbacks what to call once the touch is held long enough, and when the press ends
|
|
32
|
+
* @returns a function that stops watching at once
|
|
33
|
+
*/
|
|
34
|
+
export declare function watchLongPress(press: Press, page: Document, { onEnd, onLongPress }: LongPressCallbacks): () => void;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function e(e, n, { onEnd: r, onLongPress: i }) {
|
|
2
|
+
let a = setTimeout(() => {
|
|
3
|
+
a = void 0, t(n), i();
|
|
4
|
+
}, 500);
|
|
5
|
+
function o() {
|
|
6
|
+
clearTimeout(a), a = void 0;
|
|
7
|
+
}
|
|
8
|
+
function s(t) {
|
|
9
|
+
t.pointerId !== e.pointerId && o();
|
|
10
|
+
}
|
|
11
|
+
function c(t) {
|
|
12
|
+
let n = Math.hypot(t.clientX - e.clientX, t.clientY - e.clientY);
|
|
13
|
+
t.pointerId === e.pointerId && n > 10 && o();
|
|
14
|
+
}
|
|
15
|
+
function l(t) {
|
|
16
|
+
t.pointerId === e.pointerId && (d(), r());
|
|
17
|
+
}
|
|
18
|
+
function u(e) {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
}
|
|
21
|
+
function d() {
|
|
22
|
+
o(), n.removeEventListener("pointerdown", s, !0), n.removeEventListener("pointermove", c, !0), n.removeEventListener("pointerup", l, !0), n.removeEventListener("pointercancel", l, !0), n.removeEventListener("selectstart", u, !0);
|
|
23
|
+
}
|
|
24
|
+
return n.addEventListener("pointerdown", s, !0), n.addEventListener("pointermove", c, !0), n.addEventListener("pointerup", l, !0), n.addEventListener("pointercancel", l, !0), n.addEventListener("selectstart", u, !0), d;
|
|
25
|
+
}
|
|
26
|
+
function t(e) {
|
|
27
|
+
let t = new AbortController(), n = {
|
|
28
|
+
capture: !0,
|
|
29
|
+
signal: t.signal
|
|
30
|
+
};
|
|
31
|
+
e.addEventListener("touchend", (e) => {
|
|
32
|
+
e.preventDefault(), t.abort();
|
|
33
|
+
}, {
|
|
34
|
+
...n,
|
|
35
|
+
passive: !1
|
|
36
|
+
}), e.addEventListener("touchcancel", () => t.abort(), n);
|
|
37
|
+
}
|
|
38
|
+
export { e as watchLongPress };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Badge as e } from "../Badge/Badge.js";
|
|
2
|
+
import { VisuallyHidden as t } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
3
|
import n from "./Counter.module.js";
|
|
4
4
|
import { clsx as r } from "clsx";
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/Counter/Counter.tsx
|
|
7
7
|
function o({ capped: o = !1, className: s, count: c, hiddenSuffix: l, max: u, tone: d = "neutral", variant: f = "subtle", ...p }) {
|
|
8
8
|
if (!(c >= 1)) return null;
|
|
9
9
|
let m = u !== void 0 && c > u, h = m ? u : c;
|
|
10
|
-
return /* @__PURE__ */ a(
|
|
10
|
+
return /* @__PURE__ */ a(e, {
|
|
11
11
|
...p,
|
|
12
12
|
className: r(n.counter, s),
|
|
13
13
|
tone: d,
|
|
14
14
|
variant: f,
|
|
15
|
-
children: [m || o ? `${h}+` : h, l !== void 0 && /* @__PURE__ */ i(
|
|
15
|
+
children: [m || o ? `${h}+` : h, l !== void 0 && /* @__PURE__ */ i(t, { children: ` ${l}` })]
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { o as Counter };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { spaceValue as e } from "../../layout/spaceValue.js";
|
|
2
|
+
import { withCustomProperties as t } from "../../layout/withCustomProperties.js";
|
|
3
|
+
import { Box as n } from "../Box/Box.js";
|
|
4
4
|
import r from "./Cover.module.js";
|
|
5
5
|
import { clsx as i } from "clsx";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/Cover/Cover.tsx
|
|
8
8
|
function s({ as: s, bottom: c, className: l, gap: u = 4, minimumHeight: d = "100dvh", padding: f = 4, top: p, ...m }) {
|
|
9
9
|
let { children: h, style: g, ..._ } = m;
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
10
|
+
return /* @__PURE__ */ o(n, {
|
|
11
11
|
..._,
|
|
12
12
|
as: s,
|
|
13
13
|
className: i(r.cover, l),
|
|
14
|
-
style:
|
|
15
|
-
"--sui-cover-gap":
|
|
14
|
+
style: t({
|
|
15
|
+
"--sui-cover-gap": e(u),
|
|
16
16
|
"--sui-cover-minimum-height": d,
|
|
17
|
-
"--sui-cover-padding":
|
|
17
|
+
"--sui-cover-padding": e(f)
|
|
18
18
|
}, g),
|
|
19
19
|
children: [
|
|
20
20
|
p,
|
|
@@ -26,5 +26,4 @@ function s({ as: s, bottom: c, className: l, gap: u = 4, minimumHeight: d = "100
|
|
|
26
26
|
]
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { s as Cover };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import './Cover.css'
|
|
1
|
+
import './Cover.css';// src/components/Cover/Cover.module.css
|
|
2
2
|
var e = "sui-cover-qYwGB", t = "sui-principal-tixG4", n = {
|
|
3
3
|
cover: e,
|
|
4
4
|
principal: t
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as cover, n as default, t as principal };
|
|
@@ -2,7 +2,7 @@ import { Box as e } from "../Box/Box.js";
|
|
|
2
2
|
import t from "./Divider.module.js";
|
|
3
3
|
import { clsx as n } from "clsx";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/Divider/Divider.tsx
|
|
6
6
|
function i({ className: i, orientation: a = "horizontal", ...o }) {
|
|
7
7
|
return /* @__PURE__ */ r(e, {
|
|
8
8
|
...o,
|
|
@@ -12,5 +12,4 @@ function i({ className: i, orientation: a = "horizontal", ...o }) {
|
|
|
12
12
|
"data-orientation": a
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { i as Divider };
|
|
@@ -6,13 +6,14 @@ import i from "./Field.module.js";
|
|
|
6
6
|
import { clsx as a } from "clsx";
|
|
7
7
|
import { useId as o } from "react";
|
|
8
8
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/Field/Field.tsx
|
|
10
10
|
function l({ as: l, className: u, controlId: d, description: f, disabled: p = !1, error: m, label: h, required: g = !1, ..._ }) {
|
|
11
|
-
let { children: v, ...y } = _, b = o(), x = `${b}-description`, S = `${b}-error`, C = t(f),
|
|
11
|
+
let { children: v, ...y } = _, b = o(), x = `${b}-description`, S = `${b}-error`, C = `${b}-label`, w = t(f), T = t(m), E = t(h), D = [w && x, T && S].filter(Boolean).join(" "), O = {
|
|
12
12
|
controlId: d ?? b,
|
|
13
|
-
describedBy:
|
|
13
|
+
describedBy: D === "" ? void 0 : D,
|
|
14
14
|
disabled: p,
|
|
15
|
-
invalid:
|
|
15
|
+
invalid: T,
|
|
16
|
+
labelId: E ? C : void 0,
|
|
16
17
|
required: g
|
|
17
18
|
};
|
|
18
19
|
return /* @__PURE__ */ c(n, {
|
|
@@ -21,22 +22,23 @@ function l({ as: l, className: u, controlId: d, description: f, disabled: p = !1
|
|
|
21
22
|
className: a(i.field, u),
|
|
22
23
|
"data-disabled": p ? "" : void 0,
|
|
23
24
|
children: [
|
|
24
|
-
|
|
25
|
+
E && /* @__PURE__ */ c(n, {
|
|
25
26
|
as: "label",
|
|
26
27
|
className: i.label,
|
|
27
|
-
htmlFor:
|
|
28
|
+
htmlFor: O.controlId,
|
|
29
|
+
id: C,
|
|
28
30
|
children: [h, g && /* @__PURE__ */ s(r, {})]
|
|
29
31
|
}),
|
|
30
|
-
|
|
32
|
+
w && /* @__PURE__ */ s(n, {
|
|
31
33
|
className: i.description,
|
|
32
34
|
id: x,
|
|
33
35
|
children: f
|
|
34
36
|
}),
|
|
35
37
|
/* @__PURE__ */ s(e.Provider, {
|
|
36
|
-
value:
|
|
38
|
+
value: O,
|
|
37
39
|
children: v
|
|
38
40
|
}),
|
|
39
|
-
|
|
41
|
+
T && /* @__PURE__ */ s(n, {
|
|
40
42
|
className: i.error,
|
|
41
43
|
id: S,
|
|
42
44
|
children: m
|
|
@@ -44,5 +46,4 @@ function l({ as: l, className: u, controlId: d, description: f, disabled: p = !1
|
|
|
44
46
|
]
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
|
-
//#endregion
|
|
48
49
|
export { l as Field };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import './Field.css'
|
|
1
|
+
import './Field.css';// src/components/Field/Field.module.css
|
|
2
2
|
var e = "sui-field-m7I4B", t = "sui-label-LAQio", n = "sui-description-yqljW", r = "sui-error-m0uol", i = {
|
|
3
3
|
field: e,
|
|
4
4
|
label: t,
|
|
5
5
|
description: n,
|
|
6
6
|
error: r
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { i as default, n as description, r as error, e as field, t as label };
|
|
@@ -6,7 +6,7 @@ import { clsx as i } from "clsx";
|
|
|
6
6
|
import { useId as a } from "react";
|
|
7
7
|
import { c as o } from "react/compiler-runtime";
|
|
8
8
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/components/Fieldset/Fieldset.tsx
|
|
10
10
|
function l(l) {
|
|
11
11
|
let u = o(40), d, f, p, m, h, g, _;
|
|
12
12
|
u[0] === l ? (d = u[1], f = u[2], p = u[3], m = u[4], h = u[5], g = u[6], _ = u[7]) : ({"aria-describedby": p, children: d, className: f, description: m, error: h, label: g, ..._} = l, u[0] = l, u[1] = d, u[2] = f, u[3] = p, u[4] = m, u[5] = h, u[6] = g, u[7] = _);
|
|
@@ -61,5 +61,4 @@ function l(l) {
|
|
|
61
61
|
]
|
|
62
62
|
}), u[31] = y, u[32] = _, u[33] = P, u[34] = F, u[35] = A, u[36] = j, u[37] = M, u[38] = N, u[39] = I) : I = u[39], I;
|
|
63
63
|
}
|
|
64
|
-
//#endregion
|
|
65
64
|
export { l as Fieldset };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import './Fieldset.css'
|
|
1
|
+
import './Fieldset.css';// src/components/Fieldset/Fieldset.module.css
|
|
2
2
|
var e = "sui-fieldset-XI428", t = "sui-legend-u9wBt", n = "sui-description-KGes-", r = "sui-error-Dionz", i = {
|
|
3
3
|
fieldset: e,
|
|
4
4
|
legend: t,
|
|
5
5
|
description: n,
|
|
6
6
|
error: r
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { i as default, n as description, r as error, e as fieldset, t as legend };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { withCustomProperties as e } from "../../layout/withCustomProperties.js";
|
|
2
|
+
import { Box as t } from "../Box/Box.js";
|
|
3
3
|
import n from "./Frame.module.js";
|
|
4
4
|
import { clsx as r } from "clsx";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/Frame/Frame.tsx
|
|
7
7
|
function a({ as: a, className: o, ratio: s = "16 / 9", ...c }) {
|
|
8
8
|
let { style: l, ...u } = c;
|
|
9
|
-
return /* @__PURE__ */ i(
|
|
9
|
+
return /* @__PURE__ */ i(t, {
|
|
10
10
|
...u,
|
|
11
11
|
as: a,
|
|
12
12
|
className: r(n.frame, o),
|
|
13
|
-
style:
|
|
13
|
+
style: e({ "--sui-frame-ratio": s }, l)
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { a as Frame };
|