@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,27 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
interface FragmentTargetRevealOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the panel is closed and can be found, so the fragment's target may open it
|
|
5
|
+
*/
|
|
6
|
+
findable: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Called when the page's URL fragment points inside the panel as it mounts
|
|
9
|
+
*/
|
|
10
|
+
onMatch: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the item is open
|
|
13
|
+
*/
|
|
14
|
+
open: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The panel element
|
|
17
|
+
*/
|
|
18
|
+
panelRef: RefObject<HTMLElement | null>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Opens a closed panel when, as it mounts, the page's URL fragment points at an element inside it, and scrolls that
|
|
22
|
+
* element into view once the panel has opened
|
|
23
|
+
*
|
|
24
|
+
* @param options the panel, its state and what to do on a match
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFragmentTargetReveal({ findable, onMatch, open, panelRef }: FragmentTargetRevealOptions): void;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useEffect as e, useLayoutEffect as t, useRef as n } from "react";
|
|
2
|
+
import { c as r } from "react/compiler-runtime";
|
|
3
|
+
// src/components/Accordion/useFragmentTargetReveal.ts
|
|
4
|
+
function i(i) {
|
|
5
|
+
let o = r(8), { findable: s, onMatch: c, open: l, panelRef: u } = i, d = n(!1), f = n(null), p, m;
|
|
6
|
+
o[0] !== s || o[1] !== c || o[2] !== u ? (p = () => {
|
|
7
|
+
if (d.current) return;
|
|
8
|
+
d.current = !0;
|
|
9
|
+
let e = a();
|
|
10
|
+
s && e !== null && u.current?.contains(e) === !0 && (f.current = e, c());
|
|
11
|
+
}, m = [
|
|
12
|
+
s,
|
|
13
|
+
c,
|
|
14
|
+
u
|
|
15
|
+
], o[0] = s, o[1] = c, o[2] = u, o[3] = p, o[4] = m) : (p = o[3], m = o[4]), t(p, m);
|
|
16
|
+
let h, g;
|
|
17
|
+
o[5] === l ? (h = o[6], g = o[7]) : (h = () => {
|
|
18
|
+
l && f.current !== null && (f.current.scrollIntoView(), f.current = null);
|
|
19
|
+
}, g = [l], o[5] = l, o[6] = h, o[7] = g), e(h, g);
|
|
20
|
+
}
|
|
21
|
+
function a() {
|
|
22
|
+
let e = window.location.hash.slice(1);
|
|
23
|
+
return e === "" ? null : o(e) ?? o(s(e));
|
|
24
|
+
}
|
|
25
|
+
function o(e) {
|
|
26
|
+
return document.getElementById(e) ?? Array.from(document.getElementsByName(e)).find((e) => e instanceof HTMLAnchorElement) ?? null;
|
|
27
|
+
}
|
|
28
|
+
function s(e) {
|
|
29
|
+
let t = new TextEncoder().encode(e), n = [];
|
|
30
|
+
for (let e = 0; e < t.length; e++) {
|
|
31
|
+
let r = String.fromCharCode(t[e + 1] ?? 0, t[e + 2] ?? 0);
|
|
32
|
+
t[e] === 37 && /^[\da-f]{2}$/i.test(r) ? (n.push(Number.parseInt(r, 16)), e += 2) : n.push(t[e]);
|
|
33
|
+
}
|
|
34
|
+
return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(new Uint8Array(n));
|
|
35
|
+
}
|
|
36
|
+
export { i as useFragmentTargetReveal };
|
|
@@ -4,7 +4,7 @@ import n from "./Alert.module.js";
|
|
|
4
4
|
import { AlertIcon as r } from "./AlertIcon.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/Alert/Alert.tsx
|
|
8
8
|
function s({ children: s, className: c, icon: l, title: u, tone: d = "info", ...f }) {
|
|
9
9
|
let p = l !== null && l !== !1;
|
|
10
10
|
return /* @__PURE__ */ o(t, {
|
|
@@ -24,5 +24,4 @@ function s({ children: s, className: c, icon: l, title: u, tone: d = "info", ...
|
|
|
24
24
|
})]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { s as Alert };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import './Alert.css'
|
|
1
|
+
import './Alert.css';// src/components/Alert/Alert.module.css
|
|
2
2
|
var e = "sui-alert-7cYyI", t = "sui-icon-Zg6SB", n = "sui-content-UXnmZ", r = "sui-title-abGgF", i = {
|
|
3
3
|
alert: e,
|
|
4
4
|
icon: t,
|
|
5
5
|
content: n,
|
|
6
6
|
title: r
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { e as alert, n as content, i as default, t as icon, r as title };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box as e } from "../Box/Box.js";
|
|
2
2
|
import { c as t } from "react/compiler-runtime";
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/Alert/AlertIcon.tsx
|
|
5
5
|
var i = {
|
|
6
6
|
danger: "M15 9l-6 6M9 9l6 6",
|
|
7
7
|
info: "M12 16v-4M12 8h.01",
|
|
@@ -39,5 +39,4 @@ function a(a) {
|
|
|
39
39
|
children: [c, u]
|
|
40
40
|
}), o[4] = c, o[5] = u, o[6] = d) : d = o[6], d;
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { a as AlertIcon };
|
|
@@ -4,7 +4,7 @@ import { initialsOf as n } from "./initialsOf.js";
|
|
|
4
4
|
import { clsx as r } from "clsx";
|
|
5
5
|
import { useState as i } from "react";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/Avatar/Avatar.tsx
|
|
8
8
|
function o({ "aria-label": o, className: s, name: c, size: l = "md", src: u, ...d }) {
|
|
9
9
|
let [f, p] = i(() => /* @__PURE__ */ new Set()), m = n(c), h = l === "xs" ? Array.from(m)[0] ?? "" : m, g = u !== void 0 && u !== "" && !f.has(u), _ = o === void 0 || o.trim() === "" ? c : o;
|
|
10
10
|
return /* @__PURE__ */ a(e, {
|
|
@@ -23,5 +23,4 @@ function o({ "aria-label": o, className: s, name: c, size: l = "md", src: u, ...
|
|
|
23
23
|
}) : h
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
26
|
export { o as Avatar };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import './Avatar.css'
|
|
1
|
+
import './Avatar.css';// src/components/Avatar/Avatar.module.css
|
|
2
2
|
var e = "sui-avatar-3xMuZ", t = "sui-image-ieqGp", n = {
|
|
3
3
|
avatar: e,
|
|
4
4
|
image: t
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as avatar, n as default, t as image };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/Avatar/initialsOf.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
let n = e.split(/[^\p{L}\p{M}\p{N}]+/u).filter((e) => e !== "");
|
|
4
4
|
return n.length === 0 ? "" : (n.length === 1 ? Array.from(n[0]).slice(0, 2) : n.slice(0, 2).map(t)).join("").toUpperCase();
|
|
@@ -6,5 +6,4 @@ function e(e) {
|
|
|
6
6
|
function t(e) {
|
|
7
7
|
return String.fromCodePoint(e.codePointAt(0) ?? 0);
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { e as initialsOf };
|
|
@@ -5,7 +5,7 @@ import { clsx as r } from "clsx";
|
|
|
5
5
|
import { Children as i } from "react";
|
|
6
6
|
import { c as a } from "react/compiler-runtime";
|
|
7
7
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/AvatarGroup/AvatarGroup.tsx
|
|
9
9
|
function l(l) {
|
|
10
10
|
let u = a(28), d, f, p, m;
|
|
11
11
|
u[0] === l ? (d = u[1], f = u[2], p = u[3], m = u[4]) : ({children: d, className: f, max: p, ...m} = l, u[0] = l, u[1] = d, u[2] = f, u[3] = p, u[4] = m);
|
|
@@ -30,5 +30,4 @@ function l(l) {
|
|
|
30
30
|
children: [x, S]
|
|
31
31
|
}), u[20] = h, u[21] = _, u[22] = v, u[23] = y, u[24] = b, u[25] = x, u[26] = S, u[27] = C) : C = u[27], C;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { l as AvatarGroup };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import './AvatarGroup.css'
|
|
1
|
+
import './AvatarGroup.css';// src/components/AvatarGroup/AvatarGroup.module.css
|
|
2
2
|
var e = "sui-avatarGroup-P9iv8", t = "sui-overflow-JZIo-", n = {
|
|
3
3
|
avatarGroup: e,
|
|
4
4
|
overflow: t
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as avatarGroup, n as default, t as overflow };
|
|
@@ -2,7 +2,7 @@ import { Box as e } from "../Box/Box.js";
|
|
|
2
2
|
import t from "./Badge.module.js";
|
|
3
3
|
import { clsx as n } from "clsx";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/Badge/Badge.tsx
|
|
6
6
|
function i({ as: i, className: a, tone: o = "neutral", variant: s = "subtle", ...c }) {
|
|
7
7
|
return /* @__PURE__ */ r(e, {
|
|
8
8
|
...c,
|
|
@@ -12,5 +12,4 @@ function i({ as: i, className: a, tone: o = "neutral", variant: s = "subtle", ..
|
|
|
12
12
|
"data-variant": s
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { i as Badge };
|
|
@@ -2,7 +2,7 @@ import e from "./Box.module.js";
|
|
|
2
2
|
import { clsx as t } from "clsx";
|
|
3
3
|
import { c as n } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/Box/Box.tsx
|
|
6
6
|
function i(i) {
|
|
7
7
|
let a = n(10), o, s, c;
|
|
8
8
|
a[0] === i ? (o = a[1], s = a[2], c = a[3]) : ({as: o, className: s, ...c} = i, a[0] = i, a[1] = o, a[2] = s, a[3] = c);
|
|
@@ -14,5 +14,4 @@ function i(i) {
|
|
|
14
14
|
...c
|
|
15
15
|
}), a[6] = l, a[7] = c, a[8] = u, a[9] = d) : d = a[9], d;
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { i as Box };
|
|
@@ -3,14 +3,10 @@ import { Spinner as t } from "../Spinner/Spinner.js";
|
|
|
3
3
|
import n from "./Button.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/Button/Button.tsx
|
|
7
7
|
function o({ "aria-disabled": o, busy: s = !1, children: c, className: l, onClick: u, size: d = "md", type: f = "button", variant: p = "primary", ...m }) {
|
|
8
8
|
function h(e) {
|
|
9
|
-
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
u?.(e);
|
|
9
|
+
s ? e.preventDefault() : u?.(e);
|
|
14
10
|
}
|
|
15
11
|
return /* @__PURE__ */ a(e, {
|
|
16
12
|
...m,
|
|
@@ -25,5 +21,4 @@ function o({ "aria-disabled": o, busy: s = !1, children: c, className: l, onClic
|
|
|
25
21
|
children: [c, s && /* @__PURE__ */ i(t, { className: n.spinner })]
|
|
26
22
|
});
|
|
27
23
|
}
|
|
28
|
-
//#endregion
|
|
29
24
|
export { o as Button };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import './Button.css'
|
|
1
|
+
import './Button.css';// src/components/Button/Button.module.css
|
|
2
2
|
var e = "sui-button-2ZuB7", t = "sui-spinner-ZExvW", n = {
|
|
3
3
|
button: e,
|
|
4
4
|
spinner: t
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as button, n as default, t as spinner };
|
|
@@ -2,7 +2,7 @@ import { Box as e } from "../Box/Box.js";
|
|
|
2
2
|
import t from "./Card.module.js";
|
|
3
3
|
import { clsx as n } from "clsx";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/Card/Card.tsx
|
|
6
6
|
function i({ as: i, className: a, padding: o = "md", ...s }) {
|
|
7
7
|
return /* @__PURE__ */ r(e, {
|
|
8
8
|
...s,
|
|
@@ -11,5 +11,4 @@ function i({ as: i, className: a, padding: o = "md", ...s }) {
|
|
|
11
11
|
"data-padding": o
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { i as Card };
|
|
@@ -1,20 +1,19 @@
|
|
|
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 "./Center.module.js";
|
|
5
5
|
import { clsx as i } from "clsx";
|
|
6
6
|
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/components/Center/Center.tsx
|
|
8
8
|
function o({ as: o, className: s, gutter: c = 4, intrinsic: l = !1, width: u = "content", ...d }) {
|
|
9
9
|
let { style: f, ...p } = d;
|
|
10
|
-
return /* @__PURE__ */ a(
|
|
10
|
+
return /* @__PURE__ */ a(n, {
|
|
11
11
|
...p,
|
|
12
12
|
as: o,
|
|
13
13
|
className: i(r.center, s),
|
|
14
|
-
style:
|
|
14
|
+
style: t({ "--sui-center-gutter": e(c) }, f),
|
|
15
15
|
"data-intrinsic": l ? "" : void 0,
|
|
16
16
|
"data-width": u
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { o as Center };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChoiceControl as e } from "../ChoiceControl/ChoiceControl.js";
|
|
2
2
|
import { c as t } from "react/compiler-runtime";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
5
5
|
function r(r) {
|
|
6
6
|
let i = t(2), a;
|
|
7
7
|
return i[0] === r ? a = i[1] : (a = /* @__PURE__ */ n(e, {
|
|
@@ -9,5 +9,4 @@ function r(r) {
|
|
|
9
9
|
kind: "checkbox"
|
|
10
10
|
}), i[0] = r, i[1] = a), a;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as Checkbox };
|
|
@@ -6,7 +6,7 @@ import i from "./ChoiceControl.module.js";
|
|
|
6
6
|
import { clsx as a } from "clsx";
|
|
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/ChoiceControl/ChoiceControl.tsx
|
|
10
10
|
function l(l) {
|
|
11
11
|
let u = o(31), 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]) : ({children: d, className: f, kind: m, role: h, style: g, ...p} = l, u[0] = l, u[1] = d, u[2] = f, u[3] = p, u[4] = m, u[5] = h, u[6] = g);
|
|
@@ -36,5 +36,4 @@ function l(l) {
|
|
|
36
36
|
children: [w, T]
|
|
37
37
|
}), u[23] = v, u[24] = m, u[25] = g, u[26] = b, u[27] = x, u[28] = w, u[29] = T, u[30] = E) : E = u[30], E;
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { l as ChoiceControl };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import './ChoiceControl.css'
|
|
1
|
+
import './ChoiceControl.css';// src/components/ChoiceControl/ChoiceControl.module.css
|
|
2
2
|
var e = "sui-choiceControl-aSGqz", t = "sui-withText-bNY-W", n = "sui-input-DF-cI", r = "sui-text-4-Caz", i = {
|
|
3
3
|
choiceControl: e,
|
|
4
4
|
withText: t,
|
|
5
5
|
input: n,
|
|
6
6
|
text: r
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { e as choiceControl, i as default, n as input, r as text, t as withText };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HorizontalFlow as e } from "../HorizontalFlow/HorizontalFlow.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/components/Cluster/Cluster.tsx
|
|
4
4
|
function n({ align: n = "center", gap: r = 2, justify: i = "start", ...a }) {
|
|
5
5
|
return /* @__PURE__ */ t(e, {
|
|
6
6
|
...a,
|
|
@@ -10,5 +10,4 @@ function n({ align: n = "center", gap: r = 2, justify: i = "start", ...a }) {
|
|
|
10
10
|
wrap: !0
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { n as Cluster };
|
|
@@ -3,7 +3,7 @@ import t from "./Code.module.js";
|
|
|
3
3
|
import { clsx as n } from "clsx";
|
|
4
4
|
import { c as r } from "react/compiler-runtime";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/Code/Code.tsx
|
|
7
7
|
function a(a) {
|
|
8
8
|
let o = r(8), s, c;
|
|
9
9
|
o[0] === a ? (s = o[1], c = o[2]) : ({className: s, ...c} = a, o[0] = a, o[1] = s, o[2] = c);
|
|
@@ -16,5 +16,4 @@ function a(a) {
|
|
|
16
16
|
className: l
|
|
17
17
|
}), o[5] = c, o[6] = l, o[7] = u) : u = o[7], u;
|
|
18
18
|
}
|
|
19
|
-
//#endregion
|
|
20
19
|
export { a as Code };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import type { ControlSize } from "../../forms";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
import type { ComboboxFilter } from "./ComboboxContext";
|
|
5
|
+
import type { ComboboxPlacement } from "./ComboboxPopup";
|
|
6
|
+
interface AutocompleteOwnProps {
|
|
7
|
+
/**
|
|
8
|
+
* The `ComboboxOption`s
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The text the input starts with when `inputValue` is not given. Defaults to the selected option's text.
|
|
13
|
+
*/
|
|
14
|
+
defaultInputValue?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The option selected at first, which leaves the selection uncontrolled. Defaults to none.
|
|
17
|
+
*/
|
|
18
|
+
defaultValue?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Whether an option shows for the typed text. Defaults to the option's text containing it, ignoring case and
|
|
21
|
+
* accents. Null shows every option rendered, for a list filtered elsewhere, such as on a server; typing then makes no
|
|
22
|
+
* option active, since the options for the text are still to come.
|
|
23
|
+
*/
|
|
24
|
+
filter?: ComboboxFilter | null;
|
|
25
|
+
/**
|
|
26
|
+
* The text in the input, which makes it controlled: update it from `onInputValueChange`
|
|
27
|
+
*/
|
|
28
|
+
inputValue?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Adds a hidden input that submits the selected value with a form under this name
|
|
31
|
+
*/
|
|
32
|
+
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Called with the text as the user types, with an option's text when they commit it, and with the selected
|
|
35
|
+
* option's text, or none, when focus leaves
|
|
36
|
+
*/
|
|
37
|
+
onInputValueChange?: (inputValue: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Called with the value of the option the user commits, or null when they clear the input with Escape
|
|
40
|
+
*/
|
|
41
|
+
onValueChange?: (value: string | null) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Where the list opens. It flips to the other side when there is no room. Defaults to `bottom-start`.
|
|
44
|
+
*/
|
|
45
|
+
placement?: ComboboxPlacement;
|
|
46
|
+
/**
|
|
47
|
+
* What the live region says, and the empty list shows, for a number of matching options. Defaults to English:
|
|
48
|
+
* "No results", "1 result", "12 results".
|
|
49
|
+
*/
|
|
50
|
+
resultsLabel?: (count: number) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Height of the input, matching the `Button` sizes. Takes the place of the native `size` attribute. Defaults to
|
|
53
|
+
* `md`.
|
|
54
|
+
*/
|
|
55
|
+
size?: ControlSize;
|
|
56
|
+
/**
|
|
57
|
+
* The selected option, or null for none, which makes the selection controlled: update it from `onValueChange`
|
|
58
|
+
*/
|
|
59
|
+
value?: string | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Props for `Autocomplete`: its own props plus every `input` prop except those the combobox pattern sets
|
|
63
|
+
*/
|
|
64
|
+
export interface AutocompleteProps extends AutocompleteOwnProps, Omit<BoxProps<"input">, "aria-activedescendant" | "aria-autocomplete" | "aria-controls" | "aria-expanded" | "as" | "children" | "dangerouslySetInnerHTML" | "defaultValue" | "role" | "size" | "type" | "value" | keyof AutocompleteOwnProps> {
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A text input that filters a list of options as the user types, following the WAI-ARIA combobox pattern with list
|
|
68
|
+
* autocomplete, to choose one of many options by typing part of its name. Typing opens the list and makes the first
|
|
69
|
+
* match active; the arrow keys move through it; Enter or a click chooses an option, putting its text in the input;
|
|
70
|
+
* Escape closes the list, and then clears the input. Only an option can be the value: when focus leaves, the input shows
|
|
71
|
+
* the selected option's text again. The number of matches is announced once typing pauses. Inside a `Field` it takes
|
|
72
|
+
* its label, description, error, and required and disabled state from the field; outside one, give it an `aria-label`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* <Field label="Country">
|
|
76
|
+
* <Autocomplete name="country" onValueChange={setCountry} value={country}>
|
|
77
|
+
* <ComboboxOption value="fr">France</ComboboxOption>
|
|
78
|
+
* <ComboboxOption value="jp">Japan</ComboboxOption>
|
|
79
|
+
* </Autocomplete>
|
|
80
|
+
* </Field>
|
|
81
|
+
*/
|
|
82
|
+
export declare function Autocomplete({ children, className, defaultInputValue, defaultValue, filter, inputValue, name, onInputValueChange, onValueChange, placement, resultsLabel, size, value, ...rest }: AutocompleteProps): JSX.Element;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useFieldControl as e } from "../../forms/useFieldControl.js";
|
|
2
|
+
import { anchorNameFor as t } from "../../overlays/anchorNameFor.js";
|
|
3
|
+
import { mergeProps as n } from "../../overlays/mergeProps.js";
|
|
4
|
+
import { Box as r } from "../Box/Box.js";
|
|
5
|
+
import { ChevronDownIcon as i } from "../Icon/ChevronDownIcon.js";
|
|
6
|
+
import { TextControl as a } from "../TextControl/TextControl.js";
|
|
7
|
+
import { VisuallyHidden as o } from "../VisuallyHidden/VisuallyHidden.js";
|
|
8
|
+
import s from "./Combobox.module.js";
|
|
9
|
+
import { ComboboxPopup as c } from "./ComboboxPopup.js";
|
|
10
|
+
import { handleAutocompleteKey as l } from "./autocompleteKeys.js";
|
|
11
|
+
import { containsText as u } from "./containsText.js";
|
|
12
|
+
import { useAutocompleteText as d } from "./useAutocompleteText.js";
|
|
13
|
+
import { useComboboxList as f } from "./useComboboxList.js";
|
|
14
|
+
import { useComboboxSelection as p } from "./useComboboxSelection.js";
|
|
15
|
+
import { useResultsAnnouncement as m } from "./useResultsAnnouncement.js";
|
|
16
|
+
import { clsx as h } from "clsx";
|
|
17
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
|
+
// src/components/Combobox/Autocomplete.tsx
|
|
19
|
+
function y({ children: y, className: x, defaultInputValue: S, defaultValue: C = null, filter: w = u, inputValue: T, name: E, onInputValueChange: D, onValueChange: O, placement: k = "bottom-start", resultsLabel: A = b, size: j = "md", value: M, ...N }) {
|
|
20
|
+
let P = e(N), F = p({
|
|
21
|
+
defaultValue: C,
|
|
22
|
+
onValueChange: O,
|
|
23
|
+
value: M
|
|
24
|
+
}), I = d({
|
|
25
|
+
defaultInputValue: S,
|
|
26
|
+
inputValue: T,
|
|
27
|
+
onInputValueChange: D,
|
|
28
|
+
selectedText: F.selectedContent?.text
|
|
29
|
+
}), L = f({
|
|
30
|
+
controlId: P.id,
|
|
31
|
+
filter: w,
|
|
32
|
+
onCommit: I.commit,
|
|
33
|
+
query: I.query,
|
|
34
|
+
selection: F
|
|
35
|
+
}), { announceCount: R, announcement: z } = m(A, L.countShown, L.open), B = I.shown, V = { anchorName: t(L.listId) }, H = N.readOnly === !0;
|
|
36
|
+
function U(e) {
|
|
37
|
+
let t = e.currentTarget.value;
|
|
38
|
+
I.edit(t), L.openList("none", "keyboard"), L.matchFirst(), R();
|
|
39
|
+
}
|
|
40
|
+
function W(e) {
|
|
41
|
+
let t = {
|
|
42
|
+
commit: I.commit,
|
|
43
|
+
editing: I.editing,
|
|
44
|
+
shown: B
|
|
45
|
+
};
|
|
46
|
+
!e.defaultPrevented && !H && l(e, L, t) && e.preventDefault();
|
|
47
|
+
}
|
|
48
|
+
function G(e) {
|
|
49
|
+
e.defaultPrevented || H || L.open || L.openList("none", "pointer");
|
|
50
|
+
}
|
|
51
|
+
function K(e) {
|
|
52
|
+
L.close(), e.currentTarget.ownerDocument.hasFocus() && I.restore();
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ v(g, { children: [
|
|
55
|
+
/* @__PURE__ */ v(r, {
|
|
56
|
+
as: "span",
|
|
57
|
+
className: s.inputFrame,
|
|
58
|
+
"data-disabled": P.disabled === !0 ? "" : void 0,
|
|
59
|
+
"data-size": j,
|
|
60
|
+
children: [/* @__PURE__ */ _(a, {
|
|
61
|
+
autoComplete: "off",
|
|
62
|
+
...n(N, {
|
|
63
|
+
onBlur: K,
|
|
64
|
+
onChange: U,
|
|
65
|
+
onClick: G,
|
|
66
|
+
onKeyDown: W,
|
|
67
|
+
style: V
|
|
68
|
+
}),
|
|
69
|
+
as: "input",
|
|
70
|
+
className: h(s.input, x),
|
|
71
|
+
id: L.controlId,
|
|
72
|
+
role: "combobox",
|
|
73
|
+
size: j,
|
|
74
|
+
type: "text",
|
|
75
|
+
value: B,
|
|
76
|
+
"aria-activedescendant": L.activeDescendant,
|
|
77
|
+
"aria-autocomplete": "list",
|
|
78
|
+
"aria-controls": L.listId,
|
|
79
|
+
"aria-expanded": L.open
|
|
80
|
+
}), /* @__PURE__ */ _(i, { className: s.chevron })]
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ _(c, {
|
|
83
|
+
"aria-label": N["aria-label"],
|
|
84
|
+
"aria-labelledby": N["aria-labelledby"],
|
|
85
|
+
disabled: P.disabled,
|
|
86
|
+
emptyMessage: A(0),
|
|
87
|
+
form: N.form,
|
|
88
|
+
list: L,
|
|
89
|
+
name: E,
|
|
90
|
+
placement: k,
|
|
91
|
+
children: y
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ _(o, {
|
|
94
|
+
"aria-live": "polite",
|
|
95
|
+
children: z
|
|
96
|
+
})
|
|
97
|
+
] });
|
|
98
|
+
}
|
|
99
|
+
function b(e) {
|
|
100
|
+
return e === 0 ? "No results" : e === 1 ? "1 result" : `${e} results`;
|
|
101
|
+
}
|
|
102
|
+
export { y as Autocomplete };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-field-BenH0{align-items:center;gap:var(--sui-space-2,.5rem);text-align:start;cursor:default;min-inline-size:0;display:inline-flex}.sui-placeholder-NQX-b,.sui-fieldLabel-zBN6l{text-overflow:ellipsis;white-space:nowrap;flex:1;min-inline-size:0;overflow:hidden}.sui-placeholder-NQX-b{color:var(--sui-color-text-muted,#4b5563)}.sui-fieldLeading-4y-j7{flex:none;align-items:center;block-size:1lh;display:flex}.sui-chevron-NVqyn{flex:none;transition:rotate .12s}[aria-expanded=true]+.sui-chevron-NVqyn,[aria-expanded=true]>.sui-chevron-NVqyn{rotate:180deg}.sui-inputFrame-mYx2Q{--_sui-combobox-chevron-inset:var(--sui-space-4,1rem);align-items:center;display:inline-grid}.sui-inputFrame-mYx2Q[data-size=sm]{--_sui-combobox-chevron-inset:var(--sui-space-3,.75rem)}.sui-inputFrame-mYx2Q[data-size=lg]{--_sui-combobox-chevron-inset:var(--sui-space-6,1.5rem)}.sui-inputFrame-mYx2Q>*{grid-area:1/1}.sui-inputFrame-mYx2Q .sui-input--HTv1{padding-inline-end:calc(var(--_sui-combobox-chevron-inset) + 1em + var(--sui-space-2,.5rem))}.sui-inputFrame-mYx2Q .sui-chevron-NVqyn{color:var(--sui-color-text,#111827);pointer-events:none;justify-self:end;margin-inline-end:var(--_sui-combobox-chevron-inset)}.sui-inputFrame-mYx2Q[data-disabled] .sui-chevron-NVqyn{opacity:.5}.sui-popup-rsvuH:popover-open{min-inline-size:max(12rem, anchor-size(width));max-inline-size:min(max(20rem, anchor-size(width)), 100vw - var(--sui-space-2,.5rem) * 2);overflow:hidden}.sui-listbox-2wSrg{--_sui-menu-leading-column:calc(1rem + var(--sui-space-2,.5rem));overscroll-behavior:contain;flex-direction:column;flex:auto;gap:1px;min-block-size:0;display:flex;overflow-y:auto}.sui-option-vhhn5[hidden]{display:none}.sui-option-vhhn5 .sui-check-9yQbP{color:var(--_sui-menu-ink)}.sui-optionLeading-kXakJ{opacity:var(--_sui-menu-part-opacity,1);flex:none;align-items:center;display:flex}.sui-empty-Ahw5K{min-block-size:2rem;padding:var(--sui-space-1,.25rem) var(--sui-space-2,.5rem);color:var(--sui-color-text-muted,#4b5563);align-items:center;display:none}.sui-listbox-2wSrg[data-empty]+.sui-empty-Ahw5K{display:flex}
|