@krelborn/stylesui 0.0.0-stage → 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/LICENSE +74 -0
- package/README.md +129 -2
- package/dist/accessibility/RequiredAccessibleName.d.ts +26 -0
- package/dist/accessibility/idSegment.d.ts +7 -0
- package/dist/accessibility/idSegment.js +5 -0
- package/dist/accessibility/index.d.ts +2 -0
- package/dist/collections/index.d.ts +7 -0
- package/dist/collections/optionId.d.ts +8 -0
- package/dist/collections/optionId.js +6 -0
- package/dist/collections/renderedOptions.d.ts +37 -0
- package/dist/collections/renderedOptions.js +17 -0
- package/dist/collections/targetIndexForKey.d.ts +45 -0
- package/dist/collections/targetIndexForKey.js +16 -0
- package/dist/collections/typeAhead.d.ts +43 -0
- package/dist/collections/typeAhead.js +18 -0
- 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.css +1 -0
- package/dist/components/Alert/Alert.d.ts +47 -0
- package/dist/components/Alert/Alert.js +27 -0
- package/dist/components/Alert/Alert.module.js +8 -0
- package/dist/components/Alert/AlertIcon.d.ts +14 -0
- package/dist/components/Alert/AlertIcon.js +42 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.css +1 -0
- package/dist/components/Avatar/Avatar.d.ts +33 -0
- package/dist/components/Avatar/Avatar.js +26 -0
- package/dist/components/Avatar/Avatar.module.js +6 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/initialsOf.d.ts +9 -0
- package/dist/components/Avatar/initialsOf.js +9 -0
- package/dist/components/AvatarGroup/AvatarGroup.css +1 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +33 -0
- package/dist/components/AvatarGroup/AvatarGroup.module.js +6 -0
- package/dist/components/AvatarGroup/index.d.ts +2 -0
- package/dist/components/Badge/Badge.css +1 -0
- package/dist/components/Badge/Badge.d.ts +36 -0
- package/dist/components/Badge/Badge.js +15 -0
- package/dist/components/Badge/Badge.module.js +3 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Box/Box.css +1 -0
- package/dist/components/Box/Box.d.ts +31 -0
- package/dist/components/Box/Box.js +17 -0
- package/dist/components/Box/Box.module.js +3 -0
- package/dist/components/Box/index.d.ts +2 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button.d.ts +42 -0
- package/dist/components/Button/Button.js +24 -0
- package/dist/components/Button/Button.module.js +6 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.css +1 -0
- package/dist/components/Card/Card.d.ts +24 -0
- package/dist/components/Card/Card.js +14 -0
- package/dist/components/Card/Card.module.js +3 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Center/Center.css +1 -0
- package/dist/components/Center/Center.d.ts +34 -0
- package/dist/components/Center/Center.js +19 -0
- package/dist/components/Center/Center.module.js +3 -0
- package/dist/components/Center/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox/Checkbox.js +12 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/ChoiceControl/ChoiceControl.css +1 -0
- package/dist/components/ChoiceControl/ChoiceControl.d.ts +21 -0
- package/dist/components/ChoiceControl/ChoiceControl.js +39 -0
- package/dist/components/ChoiceControl/ChoiceControl.module.js +8 -0
- package/dist/components/ChoiceControl/index.d.ts +1 -0
- package/dist/components/Cluster/Cluster.d.ts +29 -0
- package/dist/components/Cluster/Cluster.js +13 -0
- package/dist/components/Cluster/index.d.ts +2 -0
- package/dist/components/Code/Code.css +1 -0
- package/dist/components/Code/Code.d.ts +13 -0
- package/dist/components/Code/Code.js +19 -0
- package/dist/components/Code/Code.module.js +3 -0
- package/dist/components/Code/index.d.ts +2 -0
- 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.css +1 -0
- package/dist/components/Counter/Counter.d.ts +39 -0
- package/dist/components/Counter/Counter.js +18 -0
- package/dist/components/Counter/Counter.module.js +3 -0
- package/dist/components/Counter/index.d.ts +2 -0
- package/dist/components/Cover/Cover.css +1 -0
- package/dist/components/Cover/Cover.d.ts +40 -0
- package/dist/components/Cover/Cover.js +29 -0
- package/dist/components/Cover/Cover.module.js +6 -0
- package/dist/components/Cover/index.d.ts +2 -0
- package/dist/components/Divider/Divider.css +1 -0
- package/dist/components/Divider/Divider.d.ts +25 -0
- package/dist/components/Divider/Divider.js +15 -0
- package/dist/components/Divider/Divider.module.js +3 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Field/Field.css +1 -0
- package/dist/components/Field/Field.d.ts +49 -0
- package/dist/components/Field/Field.js +49 -0
- package/dist/components/Field/Field.module.js +8 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.css +1 -0
- package/dist/components/Fieldset/Fieldset.d.ts +35 -0
- package/dist/components/Fieldset/Fieldset.js +64 -0
- package/dist/components/Fieldset/Fieldset.module.js +8 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Frame/Frame.css +1 -0
- package/dist/components/Frame/Frame.d.ts +23 -0
- package/dist/components/Frame/Frame.js +16 -0
- package/dist/components/Frame/Frame.module.js +3 -0
- package/dist/components/Frame/index.d.ts +2 -0
- package/dist/components/Grid/Grid.css +1 -0
- package/dist/components/Grid/Grid.d.ts +25 -0
- package/dist/components/Grid/Grid.js +22 -0
- package/dist/components/Grid/Grid.module.js +3 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/Heading/Heading.css +1 -0
- package/dist/components/Heading/Heading.d.ts +39 -0
- package/dist/components/Heading/Heading.js +23 -0
- package/dist/components/Heading/Heading.module.js +3 -0
- package/dist/components/Heading/index.d.ts +2 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.css +1 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.d.ts +30 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.js +30 -0
- package/dist/components/HorizontalFlow/HorizontalFlow.module.js +3 -0
- package/dist/components/HorizontalFlow/index.d.ts +2 -0
- package/dist/components/Icon/AddIcon.d.ts +11 -0
- package/dist/components/Icon/AddIcon.js +21 -0
- package/dist/components/Icon/CheckIcon.d.ts +11 -0
- package/dist/components/Icon/CheckIcon.js +18 -0
- package/dist/components/Icon/ChevronDownIcon.d.ts +11 -0
- package/dist/components/Icon/ChevronDownIcon.js +18 -0
- package/dist/components/Icon/ChevronRightIcon.d.ts +11 -0
- package/dist/components/Icon/ChevronRightIcon.js +19 -0
- package/dist/components/Icon/CloseIcon.d.ts +12 -0
- package/dist/components/Icon/CloseIcon.js +21 -0
- package/dist/components/Icon/ColorModeIcon.d.ts +12 -0
- package/dist/components/Icon/ColorModeIcon.js +36 -0
- package/dist/components/Icon/DeleteIcon.d.ts +11 -0
- package/dist/components/Icon/DeleteIcon.js +36 -0
- package/dist/components/Icon/Icon.css +1 -0
- package/dist/components/Icon/Icon.d.ts +40 -0
- package/dist/components/Icon/Icon.js +27 -0
- package/dist/components/Icon/Icon.module.js +6 -0
- package/dist/components/Icon/InfoIcon.d.ts +11 -0
- package/dist/components/Icon/InfoIcon.js +30 -0
- package/dist/components/Icon/MenuIcon.d.ts +12 -0
- package/dist/components/Icon/MenuIcon.js +28 -0
- package/dist/components/Icon/MoreHorizontalIcon.d.ts +11 -0
- package/dist/components/Icon/MoreHorizontalIcon.js +34 -0
- package/dist/components/Icon/MoreVerticalIcon.d.ts +11 -0
- package/dist/components/Icon/MoreVerticalIcon.js +34 -0
- package/dist/components/Icon/PaletteIcon.d.ts +12 -0
- package/dist/components/Icon/PaletteIcon.js +48 -0
- package/dist/components/Icon/RefreshIcon.d.ts +13 -0
- package/dist/components/Icon/RefreshIcon.js +32 -0
- package/dist/components/Icon/RemoveIcon.d.ts +11 -0
- package/dist/components/Icon/RemoveIcon.js +18 -0
- package/dist/components/Icon/SendIcon.d.ts +11 -0
- package/dist/components/Icon/SendIcon.js +22 -0
- package/dist/components/Icon/index.d.ts +16 -0
- package/dist/components/IconButton/IconButton.css +1 -0
- package/dist/components/IconButton/IconButton.d.ts +45 -0
- package/dist/components/IconButton/IconButton.js +40 -0
- package/dist/components/IconButton/IconButton.module.js +7 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/Kbd/Kbd.css +1 -0
- package/dist/components/Kbd/Kbd.d.ts +13 -0
- package/dist/components/Kbd/Kbd.js +19 -0
- package/dist/components/Kbd/Kbd.module.js +3 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Link/Link.css +1 -0
- package/dist/components/Link/Link.d.ts +52 -0
- package/dist/components/Link/Link.js +26 -0
- package/dist/components/Link/Link.module.js +3 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Listbox/Listbox.css +1 -0
- package/dist/components/Listbox/Listbox.d.ts +46 -0
- package/dist/components/Listbox/Listbox.js +55 -0
- package/dist/components/Listbox/Listbox.module.js +6 -0
- package/dist/components/Listbox/ListboxContext.d.ts +38 -0
- package/dist/components/Listbox/ListboxContext.js +4 -0
- package/dist/components/Listbox/ListboxOption.d.ts +31 -0
- package/dist/components/Listbox/ListboxOption.js +42 -0
- package/dist/components/Listbox/index.d.ts +4 -0
- package/dist/components/Listbox/useListbox.d.ts +54 -0
- package/dist/components/Listbox/useListbox.js +103 -0
- package/dist/components/Listbox/useListboxContext.d.ts +9 -0
- package/dist/components/Listbox/useListboxContext.js +10 -0
- 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.css +1 -0
- package/dist/components/NavList/NavList.d.ts +20 -0
- package/dist/components/NavList/NavList.js +27 -0
- package/dist/components/NavList/NavList.module.js +11 -0
- package/dist/components/NavList/NavListGroup.d.ts +25 -0
- package/dist/components/NavList/NavListGroup.js +39 -0
- package/dist/components/NavList/NavListItem.d.ts +49 -0
- package/dist/components/NavList/NavListItem.js +56 -0
- package/dist/components/NavList/index.d.ts +6 -0
- package/dist/components/Overlay/Overlay.css +1 -0
- package/dist/components/Overlay/Overlay.d.ts +33 -0
- package/dist/components/Overlay/Overlay.js +35 -0
- package/dist/components/Overlay/Overlay.module.js +3 -0
- package/dist/components/Overlay/index.d.ts +1 -0
- package/dist/components/PageLayout/PageLayout.css +1 -0
- package/dist/components/PageLayout/PageLayout.d.ts +26 -0
- package/dist/components/PageLayout/PageLayout.js +17 -0
- package/dist/components/PageLayout/PageLayout.module.js +3 -0
- package/dist/components/PageLayout/index.d.ts +2 -0
- package/dist/components/Popover/Popover.css +1 -0
- package/dist/components/Popover/Popover.d.ts +52 -0
- package/dist/components/Popover/Popover.js +20 -0
- package/dist/components/Popover/Popover.module.js +3 -0
- package/dist/components/Popover/index.d.ts +4 -0
- package/dist/components/Popover/usePopover.d.ts +96 -0
- package/dist/components/Popover/usePopover.js +71 -0
- package/dist/components/Prose/Prose.css +1 -0
- package/dist/components/Prose/Prose.d.ts +50 -0
- package/dist/components/Prose/Prose.js +15 -0
- package/dist/components/Prose/Prose.module.js +3 -0
- package/dist/components/Prose/index.d.ts +2 -0
- package/dist/components/Radio/Radio.d.ts +29 -0
- package/dist/components/Radio/Radio.js +23 -0
- package/dist/components/Radio/index.d.ts +2 -0
- package/dist/components/RadioGroup/RadioGroup.css +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +58 -0
- package/dist/components/RadioGroup/RadioGroup.js +36 -0
- package/dist/components/RadioGroup/RadioGroup.module.js +3 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.css +1 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.d.ts +6 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.js +15 -0
- package/dist/components/RequiredIndicator/RequiredIndicator.module.js +3 -0
- package/dist/components/RequiredIndicator/index.d.ts +1 -0
- package/dist/components/Row/Row.d.ts +29 -0
- package/dist/components/Row/Row.js +13 -0
- package/dist/components/Row/index.d.ts +2 -0
- package/dist/components/SegmentedControl/Segment.d.ts +24 -0
- package/dist/components/SegmentedControl/Segment.js +41 -0
- package/dist/components/SegmentedControl/SegmentedControl.css +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +25 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +19 -0
- package/dist/components/SegmentedControl/SegmentedControl.module.js +9 -0
- package/dist/components/SegmentedControl/index.d.ts +4 -0
- package/dist/components/Select/Select.d.ts +27 -0
- package/dist/components/Select/Select.js +11 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.css +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +42 -0
- package/dist/components/Sidebar/Sidebar.js +23 -0
- package/dist/components/Sidebar/Sidebar.module.js +3 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/SkipLink/SkipLink.css +1 -0
- package/dist/components/SkipLink/SkipLink.d.ts +20 -0
- package/dist/components/SkipLink/SkipLink.js +20 -0
- package/dist/components/SkipLink/SkipLink.module.js +3 -0
- package/dist/components/SkipLink/index.d.ts +2 -0
- package/dist/components/Spinner/Spinner.css +1 -0
- package/dist/components/Spinner/Spinner.d.ts +13 -0
- package/dist/components/Spinner/Spinner.js +32 -0
- package/dist/components/Spinner/Spinner.module.js +7 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Stack/Stack.css +1 -0
- package/dist/components/Stack/Stack.d.ts +25 -0
- package/dist/components/Stack/Stack.js +20 -0
- package/dist/components/Stack/Stack.module.js +3 -0
- package/dist/components/Stack/index.d.ts +2 -0
- package/dist/components/StatusDot/StatusDot.css +1 -0
- package/dist/components/StatusDot/StatusDot.d.ts +57 -0
- package/dist/components/StatusDot/StatusDot.js +20 -0
- package/dist/components/StatusDot/StatusDot.module.js +3 -0
- package/dist/components/StatusDot/index.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +24 -0
- package/dist/components/Switch/Switch.js +12 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switcher/Switcher.css +1 -0
- package/dist/components/Switcher/Switcher.d.ts +27 -0
- package/dist/components/Switcher/Switcher.js +22 -0
- package/dist/components/Switcher/Switcher.module.js +3 -0
- package/dist/components/Switcher/index.d.ts +2 -0
- package/dist/components/Tabs/Tab.d.ts +26 -0
- package/dist/components/Tabs/Tab.js +60 -0
- package/dist/components/Tabs/TabList.d.ts +16 -0
- package/dist/components/Tabs/TabList.js +22 -0
- package/dist/components/Tabs/TabPanel.d.ts +24 -0
- package/dist/components/Tabs/TabPanel.js +21 -0
- package/dist/components/Tabs/Tabs.css +1 -0
- package/dist/components/Tabs/Tabs.d.ts +81 -0
- package/dist/components/Tabs/Tabs.js +30 -0
- package/dist/components/Tabs/Tabs.module.js +8 -0
- package/dist/components/Tabs/TabsContext.d.ts +39 -0
- package/dist/components/Tabs/TabsContext.js +4 -0
- package/dist/components/Tabs/index.d.ts +8 -0
- package/dist/components/Tabs/tabIds.d.ts +16 -0
- package/dist/components/Tabs/tabIds.js +9 -0
- package/dist/components/Tabs/useTabsContext.d.ts +9 -0
- package/dist/components/Tabs/useTabsContext.js +10 -0
- package/dist/components/Text/Text.css +1 -0
- package/dist/components/Text/Text.d.ts +40 -0
- package/dist/components/Text/Text.js +16 -0
- package/dist/components/Text/Text.module.js +3 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/TextControl/TextControl.css +1 -0
- package/dist/components/TextControl/TextControl.d.ts +22 -0
- package/dist/components/TextControl/TextControl.js +27 -0
- package/dist/components/TextControl/TextControl.module.js +3 -0
- package/dist/components/TextControl/index.d.ts +1 -0
- package/dist/components/TextInput/TextInput.d.ts +31 -0
- package/dist/components/TextInput/TextInput.js +12 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/Textarea/Textarea.d.ts +24 -0
- package/dist/components/Textarea/Textarea.js +11 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Theme/Theme.d.ts +46 -0
- package/dist/components/Theme/Theme.js +17 -0
- package/dist/components/Theme/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +49 -0
- package/dist/components/Tooltip/Tooltip.js +21 -0
- package/dist/components/Tooltip/Tooltip.module.js +3 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/components/Tooltip/tooltipCoordinator.d.ts +14 -0
- package/dist/components/Tooltip/tooltipCoordinator.js +16 -0
- package/dist/components/Tooltip/useTooltip.d.ts +119 -0
- package/dist/components/Tooltip/useTooltip.js +73 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.css +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +14 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +19 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.module.js +3 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/errors/MissingContextError.d.ts +11 -0
- package/dist/errors/MissingContextError.js +8 -0
- package/dist/errors/PopoverRefusedError.d.ts +12 -0
- package/dist/errors/PopoverRefusedError.js +8 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/forms/ControlSize.d.ts +4 -0
- package/dist/forms/FieldContext.d.ts +34 -0
- package/dist/forms/FieldContext.js +4 -0
- package/dist/forms/RadioGroupContext.d.ts +34 -0
- package/dist/forms/RadioGroupContext.js +4 -0
- package/dist/forms/hasContent.d.ts +10 -0
- package/dist/forms/hasContent.js +6 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/useFieldControl.d.ts +36 -0
- package/dist/forms/useFieldControl.js +28 -0
- package/dist/forms/useRadioGroupItem.d.ts +50 -0
- package/dist/forms/useRadioGroupItem.js +26 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.js +92 -0
- package/dist/layout/Space.d.ts +4 -0
- package/dist/layout/alignment.d.ts +8 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/listRole.d.ts +11 -0
- package/dist/layout/listRole.js +5 -0
- package/dist/layout/spaceValue.d.ts +8 -0
- package/dist/layout/spaceValue.js +5 -0
- package/dist/layout/withCustomProperties.d.ts +9 -0
- package/dist/layout/withCustomProperties.js +8 -0
- 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/OverlayDelay.d.ts +13 -0
- package/dist/overlays/OverlayPlacement.d.ts +6 -0
- package/dist/overlays/anchorNameFor.d.ts +7 -0
- package/dist/overlays/anchorNameFor.js +5 -0
- package/dist/overlays/index.d.ts +6 -0
- package/dist/overlays/mergeProps.d.ts +13 -0
- package/dist/overlays/mergeProps.js +29 -0
- package/dist/overlays/syncPopover.d.ts +11 -0
- package/dist/overlays/syncPopover.js +24 -0
- package/dist/overlays/useOverlay.d.ts +71 -0
- package/dist/overlays/useOverlay.js +49 -0
- package/dist/styles.css +1 -0
- package/fonts/playful.css +3 -0
- package/package.json +103 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Avatar.module.js";
|
|
3
|
+
import { initialsOf as n } from "./initialsOf.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { useState as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Avatar/Avatar.tsx
|
|
8
|
+
function o({ "aria-label": o, className: s, name: c, size: l = "md", src: u, ...d }) {
|
|
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
|
+
return /* @__PURE__ */ a(e, {
|
|
11
|
+
...d,
|
|
12
|
+
as: "span",
|
|
13
|
+
className: r(t.avatar, s),
|
|
14
|
+
role: "img",
|
|
15
|
+
"aria-label": _,
|
|
16
|
+
"data-size": l,
|
|
17
|
+
children: g ? /* @__PURE__ */ a(e, {
|
|
18
|
+
alt: "",
|
|
19
|
+
as: "img",
|
|
20
|
+
className: t.image,
|
|
21
|
+
onError: () => p((e) => new Set(e).add(u)),
|
|
22
|
+
src: u
|
|
23
|
+
}) : h
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { o as Avatar };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picks the initials an avatar shows for a name
|
|
3
|
+
*
|
|
4
|
+
* @param name a person's or team's name, a handle such as "@plee", or a path such as "acme/web-team"
|
|
5
|
+
* @returns the first letter of each of the first two words, or the first two letters of a one-word name, upper-cased.
|
|
6
|
+
* Words are separated by anything that is not a letter, mark or digit in any script, and letters are counted by
|
|
7
|
+
* code point. Empty when the name has no letters or digits.
|
|
8
|
+
*/
|
|
9
|
+
export declare function initialsOf(name: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/components/Avatar/initialsOf.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let n = e.split(/[^\p{L}\p{M}\p{N}]+/u).filter((e) => e !== "");
|
|
4
|
+
return n.length === 0 ? "" : (n.length === 1 ? Array.from(n[0]).slice(0, 2) : n.slice(0, 2).map(t)).join("").toUpperCase();
|
|
5
|
+
}
|
|
6
|
+
function t(e) {
|
|
7
|
+
return String.fromCodePoint(e.codePointAt(0) ?? 0);
|
|
8
|
+
}
|
|
9
|
+
export { e as initialsOf };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-avatarGroup-P9iv8{align-items:center;display:inline-flex}.sui-avatarGroup-P9iv8>[role=img]{box-shadow:0 0 0 var(--sui-avatar-group-ring-width,2px) var(--sui-avatar-group-ring,var(--sui-color-background,#fff))}.sui-avatarGroup-P9iv8>[role=img]+[role=img]{margin-inline-start:calc(var(--sui-avatar-size,2rem) / -4)}.sui-overflow-JZIo-{color:var(--sui-color-text-muted,#4b5563);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-font-size-xs,.75rem);font-weight:var(--sui-font-weight-control,500);margin-inline-start:var(--sui-space-1,.25rem)}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import type { RequiredAccessibleName } from "../../accessibility";
|
|
3
|
+
import type { BoxProps } from "../Box";
|
|
4
|
+
interface AvatarGroupOwnProps {
|
|
5
|
+
/**
|
|
6
|
+
* The `Avatar`s, as direct children or an array of them
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* How many avatars show, at least 1. The rest are hidden on screen behind a "+n" count, but screen readers still
|
|
11
|
+
* read their names. Shows every avatar when left out or not a number.
|
|
12
|
+
*/
|
|
13
|
+
max?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Props for `AvatarGroup`: its own props, a required `aria-label` or `aria-labelledby`, and every other `span` prop
|
|
17
|
+
* except `role`
|
|
18
|
+
*/
|
|
19
|
+
export type AvatarGroupProps = AvatarGroupOwnProps & RequiredAccessibleName & Omit<BoxProps<"span">, "aria-label" | "aria-labelledby" | "as" | "role" | keyof AvatarGroupOwnProps>;
|
|
20
|
+
/**
|
|
21
|
+
* A row of overlapping avatars, such as a pull request's reviewers. Give it a name. Past `max`, avatars are hidden
|
|
22
|
+
* on screen behind a "+n" count, but screen readers read every name.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <AvatarGroup max={3} aria-label="Reviewers">
|
|
26
|
+
* {reviewers.map((reviewer) => <Avatar key={reviewer.login} name={reviewer.login} size="sm" />)}
|
|
27
|
+
* </AvatarGroup>
|
|
28
|
+
*/
|
|
29
|
+
export declare function AvatarGroup({ children, className, max, ...rest }: AvatarGroupProps): JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import { VisuallyHidden as t } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
|
+
import n from "./AvatarGroup.module.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { Children as i } from "react";
|
|
6
|
+
import { c as a } from "react/compiler-runtime";
|
|
7
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
// src/components/AvatarGroup/AvatarGroup.tsx
|
|
9
|
+
function l(l) {
|
|
10
|
+
let u = a(28), d, f, p, m;
|
|
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);
|
|
12
|
+
let h, g, _, v, y, b, x;
|
|
13
|
+
if (u[5] !== d || u[6] !== f || u[7] !== p || u[8] !== m) {
|
|
14
|
+
let t = i.toArray(d), a = p === void 0 || Number.isNaN(p) ? t.length : Math.max(1, p);
|
|
15
|
+
g = t.slice(a), h = e, _ = m, v = "span", u[16] === f ? y = u[17] : (y = r(n.avatarGroup, f), u[16] = f, u[17] = y), b = "group", x = t.slice(0, a), u[5] = d, u[6] = f, u[7] = p, u[8] = m, u[9] = h, u[10] = g, u[11] = _, u[12] = v, u[13] = y, u[14] = b, u[15] = x;
|
|
16
|
+
} else h = u[9], g = u[10], _ = u[11], v = u[12], y = u[13], b = u[14], x = u[15];
|
|
17
|
+
let S;
|
|
18
|
+
u[18] === g ? S = u[19] : (S = g.length > 0 && /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(t, { children: g }), /* @__PURE__ */ s(e, {
|
|
19
|
+
as: "span",
|
|
20
|
+
className: n.overflow,
|
|
21
|
+
"aria-hidden": !0,
|
|
22
|
+
children: `+${g.length}`
|
|
23
|
+
})] }), u[18] = g, u[19] = S);
|
|
24
|
+
let C;
|
|
25
|
+
return u[20] !== h || u[21] !== _ || u[22] !== v || u[23] !== y || u[24] !== b || u[25] !== x || u[26] !== S ? (C = /* @__PURE__ */ c(h, {
|
|
26
|
+
..._,
|
|
27
|
+
as: v,
|
|
28
|
+
className: y,
|
|
29
|
+
role: b,
|
|
30
|
+
children: [x, S]
|
|
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
|
+
}
|
|
33
|
+
export { l as AvatarGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-badge-RsuMz{--sui-badge-bg:var(--sui-color-secondary-subtle,#f3f4f6);--sui-badge-fg:var(--sui-color-text,#111827);--sui-badge-border:var(--sui-color-control-border,transparent);min-block-size:1.5rem;padding:var(--sui-space-1,.25rem) var(--sui-space-2,.5rem);border:var(--sui-border-width,1px) solid var(--sui-badge-border);border-radius:var(--sui-radius-md,4px);background-color:var(--sui-badge-bg);color:var(--sui-badge-fg);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-font-size-xs,.75rem);font-weight:var(--sui-font-weight-control,500);line-height:var(--sui-line-height-tight,1.25);overflow-wrap:anywhere;align-items:center;text-decoration:none;display:inline-flex}.sui-badge-RsuMz[data-tone=danger][data-variant=solid]{--sui-badge-bg:var(--sui-color-danger,#dc2626);--sui-badge-fg:var(--sui-color-on-danger,#fff)}.sui-badge-RsuMz[data-tone=danger][data-variant=subtle]{--sui-badge-bg:var(--sui-color-danger-subtle,#fff1f1);--sui-badge-fg:var(--sui-color-danger-text,#b91c1c)}.sui-badge-RsuMz[data-tone=info][data-variant=solid]{--sui-badge-bg:var(--sui-color-info,#4338ca);--sui-badge-fg:var(--sui-color-on-info,#fff)}.sui-badge-RsuMz[data-tone=info][data-variant=subtle]{--sui-badge-bg:var(--sui-color-info-subtle,#f0f3ff);--sui-badge-fg:var(--sui-color-info-text,#4338ca)}.sui-badge-RsuMz[data-tone=neutral][data-variant=solid]{--sui-badge-bg:var(--sui-color-secondary,#e5e7eb);--sui-badge-fg:var(--sui-color-on-secondary,#111827)}.sui-badge-RsuMz[data-tone=neutral][data-variant=subtle]{--sui-badge-bg:var(--sui-color-secondary-subtle,#f3f4f6);--sui-badge-fg:var(--sui-color-text,#111827)}.sui-badge-RsuMz[data-tone=primary][data-variant=solid]{--sui-badge-bg:var(--sui-color-primary,#2563eb);--sui-badge-fg:var(--sui-color-on-primary,#fff)}.sui-badge-RsuMz[data-tone=primary][data-variant=subtle]{--sui-badge-bg:var(--sui-color-primary-subtle,#edf5ff);--sui-badge-fg:var(--sui-color-primary,#2563eb)}.sui-badge-RsuMz[data-tone=success][data-variant=solid]{--sui-badge-bg:var(--sui-color-success,#15803d);--sui-badge-fg:var(--sui-color-on-success,#fff)}.sui-badge-RsuMz[data-tone=success][data-variant=subtle]{--sui-badge-bg:var(--sui-color-success-subtle,#eefef3);--sui-badge-fg:var(--sui-color-success-text,#166534)}.sui-badge-RsuMz[data-tone=warning][data-variant=solid]{--sui-badge-bg:var(--sui-color-warning,#eab308);--sui-badge-fg:var(--sui-color-on-warning,#111827)}.sui-badge-RsuMz[data-tone=warning][data-variant=subtle]{--sui-badge-bg:var(--sui-color-warning-subtle,#fffce1);--sui-badge-fg:var(--sui-color-warning-text,#854d0e)}.sui-badge-RsuMz:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Elements a `Badge` can render: a `span`, or an `a` or `button` for a badge that links or acts
|
|
5
|
+
*/
|
|
6
|
+
export type BadgeElement = "a" | "button" | "span";
|
|
7
|
+
/**
|
|
8
|
+
* Badge colours: the theme's status colours, its primary colour, or its secondary colour for `neutral`
|
|
9
|
+
*/
|
|
10
|
+
export type BadgeTone = "danger" | "info" | "neutral" | "primary" | "success" | "warning";
|
|
11
|
+
/**
|
|
12
|
+
* Badge styles: a solid tone fill, or a subtle tinted background with tone-coloured text
|
|
13
|
+
*/
|
|
14
|
+
export type BadgeVariant = "solid" | "subtle";
|
|
15
|
+
interface BadgeOwnProps {
|
|
16
|
+
/**
|
|
17
|
+
* Badge colour. Defaults to `neutral`.
|
|
18
|
+
*/
|
|
19
|
+
tone?: BadgeTone;
|
|
20
|
+
/**
|
|
21
|
+
* Visual style. Defaults to `subtle`.
|
|
22
|
+
*/
|
|
23
|
+
variant?: BadgeVariant;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props for `Badge`: its own props plus every prop supported by the element given in `as`
|
|
27
|
+
*/
|
|
28
|
+
export type BadgeProps<E extends BadgeElement = "span"> = BadgeOwnProps & Omit<BoxProps<E>, keyof BadgeOwnProps>;
|
|
29
|
+
/**
|
|
30
|
+
* Small label for a tag, a status or a count
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <Badge tone="success" variant="solid">Published</Badge>
|
|
34
|
+
*/
|
|
35
|
+
export declare function Badge<E extends BadgeElement = "span">({ as, className, tone, variant, ...rest }: BadgeProps<E>): JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Badge.module.js";
|
|
3
|
+
import { clsx as n } from "clsx";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Badge/Badge.tsx
|
|
6
|
+
function i({ as: i, className: a, tone: o = "neutral", variant: s = "subtle", ...c }) {
|
|
7
|
+
return /* @__PURE__ */ r(e, {
|
|
8
|
+
...c,
|
|
9
|
+
as: i ?? "span",
|
|
10
|
+
className: n(t.badge, a),
|
|
11
|
+
"data-tone": o,
|
|
12
|
+
"data-variant": s
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { i as Badge };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-box-Wgbf3{box-sizing:border-box}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, JSX } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Intrinsic element names that `Box` can render
|
|
4
|
+
*/
|
|
5
|
+
export type BoxElement = keyof JSX.IntrinsicElements;
|
|
6
|
+
type BoxOwnProps<E extends BoxElement> = {
|
|
7
|
+
/**
|
|
8
|
+
* DOM element to render. Defaults to the component's default element (`div` for Box).
|
|
9
|
+
*/
|
|
10
|
+
as?: E;
|
|
11
|
+
/**
|
|
12
|
+
* Class names merged with the component's base class.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Props for `Box`: its own props plus every prop supported by the element given in `as`. */
|
|
17
|
+
export type BoxProps<E extends BoxElement = "div"> = BoxOwnProps<E> & Omit<ComponentPropsWithRef<E>, keyof BoxOwnProps<E>>;
|
|
18
|
+
/**
|
|
19
|
+
* Props for a polymorphic component built on `Box`: `OwnProps` plus every prop `Box` accepts for
|
|
20
|
+
* the element given in `as`, minus any name `OwnProps` already declares.
|
|
21
|
+
*/
|
|
22
|
+
export type PolymorphicProps<E extends BoxElement, OwnProps extends object> = OwnProps & Omit<BoxProps<E>, keyof OwnProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Polymorphic primitive that renders the DOM element given in `as` and forwards all of its props.
|
|
25
|
+
* Foundation for other StylesUI components.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Box as="button" onClick={() => console.log('Clicked')}>Click Me</Box>
|
|
29
|
+
*/
|
|
30
|
+
export declare function Box<E extends BoxElement = "div">({ as, className, ...rest }: BoxProps<E>): JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import e from "./Box.module.js";
|
|
2
|
+
import { clsx as t } from "clsx";
|
|
3
|
+
import { c as n } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Box/Box.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let a = n(10), o, s, c;
|
|
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);
|
|
9
|
+
let l = o ?? "div", u;
|
|
10
|
+
a[4] === s ? u = a[5] : (u = t(e.box, s), a[4] = s, a[5] = u);
|
|
11
|
+
let d;
|
|
12
|
+
return a[6] !== l || a[7] !== c || a[8] !== u ? (d = /* @__PURE__ */ r(l, {
|
|
13
|
+
className: u,
|
|
14
|
+
...c
|
|
15
|
+
}), a[6] = l, a[7] = c, a[8] = u, a[9] = d) : d = a[9], d;
|
|
16
|
+
}
|
|
17
|
+
export { i as Box };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-button-2ZuB7{--sui-button-bg:var(--sui-color-primary,#2563eb);--sui-button-bg-hover:var(--sui-color-primary-hover,#1d4ed8);--sui-button-fg:var(--sui-color-on-primary,#fff);--sui-button-border:var(--sui-color-control-border,transparent);--sui-button-border-width:var(--sui-border-width,1px);--sui-button-radius:var(--sui-radius-control,4px);--sui-button-padding-x:var(--sui-space-4,1rem);--sui-button-padding-y:var(--sui-space-2,.5rem);--sui-button-font-size:var(--sui-font-size-md,1rem);--sui-button-font-weight:var(--sui-font-weight-control,500);--sui-button-depth:var(--sui-control-depth,0px);--sui-button-lip:var(--sui-color-shadow,transparent);--sui-button-spring:var(--sui-motion-spring,.12s ease-out);justify-content:center;align-items:center;gap:var(--sui-space-2,.5rem);padding:var(--sui-button-padding-y) var(--sui-button-padding-x);border:var(--sui-button-border-width) solid var(--sui-button-border);border-radius:var(--sui-button-radius);background-color:var(--sui-button-bg);box-shadow:0 var(--sui-button-depth) 0 var(--sui-button-lip);color:var(--sui-button-fg);font-family:var(--sui-font-body,system-ui, sans-serif);font-size:var(--sui-button-font-size);font-weight:var(--sui-button-font-weight);line-height:var(--sui-line-height-tight,1.25);cursor:pointer;transition:background-color .12s ease, border-color .12s ease, box-shadow var(--sui-button-spring), transform var(--sui-button-spring);display:inline-flex}.sui-button-2ZuB7[data-variant=secondary]{--sui-button-bg:var(--sui-color-secondary,#e5e7eb);--sui-button-bg-hover:var(--sui-color-secondary-hover,#d1d5db);--sui-button-fg:var(--sui-color-on-secondary,#111827)}.sui-button-2ZuB7[data-variant=danger]{--sui-button-bg:var(--sui-color-danger,#dc2626);--sui-button-bg-hover:var(--sui-color-danger-hover,#b91c1c);--sui-button-fg:var(--sui-color-on-danger,#fff)}.sui-button-2ZuB7[data-variant=info]{--sui-button-bg:var(--sui-color-info,#4338ca);--sui-button-bg-hover:var(--sui-color-info-hover,#3730a3);--sui-button-fg:var(--sui-color-on-info,#fff)}.sui-button-2ZuB7[data-variant=success]{--sui-button-bg:var(--sui-color-success,#15803d);--sui-button-bg-hover:var(--sui-color-success-hover,#166534);--sui-button-fg:var(--sui-color-on-success,#fff)}.sui-button-2ZuB7[data-variant=warning]{--sui-button-bg:var(--sui-color-warning,#eab308);--sui-button-bg-hover:var(--sui-color-warning-hover,#facc15);--sui-button-fg:var(--sui-color-on-warning,#111827)}.sui-button-2ZuB7:is([data-variant=ghost],[data-variant^=outline-]){--sui-button-bg:transparent;--sui-button-bg-hover:color-mix(in srgb, var(--sui-button-fg) 8%, transparent)}.sui-button-2ZuB7[data-variant=outline-primary]{--sui-button-fg:var(--sui-color-primary,#2563eb);--sui-button-border:var(--sui-color-primary,#2563eb)}.sui-button-2ZuB7[data-variant=outline-secondary]{--sui-button-fg:var(--sui-color-text,#111827);--sui-button-border:var(--sui-color-input-border,#6b7280)}.sui-button-2ZuB7[data-variant=outline-danger]{--sui-button-fg:var(--sui-color-danger-text,#b91c1c);--sui-button-border:var(--sui-color-danger-text,#b91c1c)}.sui-button-2ZuB7[data-variant=outline-info]{--sui-button-fg:var(--sui-color-info-text,#4338ca);--sui-button-border:var(--sui-color-info-text,#4338ca)}.sui-button-2ZuB7[data-variant=outline-success]{--sui-button-fg:var(--sui-color-success-text,#166534);--sui-button-border:var(--sui-color-success-text,#166534)}.sui-button-2ZuB7[data-variant=outline-warning]{--sui-button-fg:var(--sui-color-warning-text,#854d0e);--sui-button-border:var(--sui-color-warning-text,#854d0e)}.sui-button-2ZuB7[data-variant=ghost]{--sui-button-fg:var(--sui-color-text,#111827);--sui-button-border:transparent;--sui-button-depth:0px}.sui-button-2ZuB7[data-size=sm]{--sui-button-padding-x:var(--sui-space-3,.75rem);--sui-button-padding-y:var(--sui-space-1,.25rem);--sui-button-font-size:var(--sui-font-size-sm,.875rem)}.sui-button-2ZuB7[data-size=lg]{--sui-button-padding-x:var(--sui-space-6,1.5rem);--sui-button-padding-y:var(--sui-space-3,.75rem);--sui-button-font-size:var(--sui-font-size-lg,1.125rem)}.sui-button-2ZuB7:hover:not(:disabled,[data-busy]){background-color:var(--sui-button-bg-hover)}@media (hover:hover){.sui-button-2ZuB7:hover:not(:disabled,[data-busy]){box-shadow:0 calc(var(--sui-button-depth) * 1.5) 0 var(--sui-button-lip);transform:translateY(calc(var(--sui-button-depth) / -2))}}.sui-button-2ZuB7:active:not(:disabled,[data-busy]){box-shadow:0 0 0 var(--sui-button-lip);transform:translateY(var(--sui-button-depth));transition-duration:.12s;transition-timing-function:ease-out}.sui-button-2ZuB7[data-variant=ghost]:active:not(:disabled,[data-busy]){background-color:color-mix(in srgb, var(--sui-button-fg) 16%, transparent)}.sui-button-2ZuB7:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}.sui-button-2ZuB7:disabled{cursor:not-allowed;opacity:.5}.sui-button-2ZuB7[data-busy]{color:#0000;cursor:progress}.sui-button-2ZuB7[data-busy]>:not(.sui-spinner-ZExvW){opacity:0}:where(.sui-button-2ZuB7[data-busy]){position:relative}.sui-spinner-ZExvW{color:var(--sui-button-fg);margin:auto;position:absolute;inset:0}@media (prefers-reduced-motion:reduce){.sui-button-2ZuB7{transition:background-color .12s,border-color .12s}}@media (forced-colors:active){.sui-button-2ZuB7[data-busy]{box-shadow:none;color:#0000;forced-color-adjust:none;background-color:buttonface;border-color:buttonborder}.sui-button-2ZuB7[data-busy]:focus-visible{outline-color:highlight}.sui-spinner-ZExvW{color:buttontext}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Button sizes, controlling padding and font size
|
|
5
|
+
*/
|
|
6
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
7
|
+
/**
|
|
8
|
+
* Button styles: filled in the primary, secondary or a status colour, outlined in one of those colours
|
|
9
|
+
* (`outline-<colour>`), or `ghost`, which has no border and no fill until it is hovered, and never sits on a lip. Use
|
|
10
|
+
* `danger` or `outline-danger` for an action that destroys something, such as deleting, and the other status colours
|
|
11
|
+
* for an action tied to that status.
|
|
12
|
+
*/
|
|
13
|
+
export type ButtonVariant = "danger" | "ghost" | "info" | "outline-danger" | "outline-info" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-warning" | "primary" | "secondary" | "success" | "warning";
|
|
14
|
+
/**
|
|
15
|
+
* Props for `Button`: its own props plus every native button prop
|
|
16
|
+
*/
|
|
17
|
+
export interface ButtonProps extends Omit<BoxProps<"button">, "as"> {
|
|
18
|
+
/**
|
|
19
|
+
* Whether the button's action is running. A busy button shows a spinner in place of its content, keeps its width
|
|
20
|
+
* and accessible name, stays focusable, and ignores presses, including a form's submission. The spinner is not
|
|
21
|
+
* announced, so pair `busy` with a status message that announces the outcome. Defaults to `false`.
|
|
22
|
+
*/
|
|
23
|
+
busy?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Button size. Defaults to `md`.
|
|
26
|
+
*/
|
|
27
|
+
size?: ButtonSize;
|
|
28
|
+
/**
|
|
29
|
+
* Visual style. Defaults to `primary`.
|
|
30
|
+
*/
|
|
31
|
+
variant?: ButtonVariant;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Themed button. `type` defaults to `"button"`, so it never submits a form unless asked to.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <Button onClick={save} variant="secondary">Save</Button>
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <Button busy={isSaving} type="submit">Save</Button>
|
|
41
|
+
*/
|
|
42
|
+
export declare function Button({ "aria-disabled": ariaDisabled, busy, children, className, onClick, size, type, variant, ...rest }: ButtonProps): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import { Spinner as t } from "../Spinner/Spinner.js";
|
|
3
|
+
import n from "./Button.module.js";
|
|
4
|
+
import { clsx as r } from "clsx";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Button/Button.tsx
|
|
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
|
+
function h(e) {
|
|
9
|
+
s ? e.preventDefault() : u?.(e);
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ a(e, {
|
|
12
|
+
...m,
|
|
13
|
+
as: "button",
|
|
14
|
+
className: r(n.button, l),
|
|
15
|
+
onClick: h,
|
|
16
|
+
type: f,
|
|
17
|
+
"aria-disabled": s ? !0 : o,
|
|
18
|
+
"data-busy": s ? "" : void 0,
|
|
19
|
+
"data-size": d,
|
|
20
|
+
"data-variant": p,
|
|
21
|
+
children: [c, s && /* @__PURE__ */ i(t, { className: n.spinner })]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { o as Button };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-card-Cb1o4{--sui-card-bg:var(--sui-color-surface,#f3f4f6);--sui-card-border:var(--sui-color-border,#d1d5db);--sui-card-border-width:var(--sui-border-width,1px);--sui-card-radius:var(--sui-radius-lg,8px);--sui-card-shadow:var(--sui-shadow-sm,0 1px 3px #0000001f);--sui-card-padding:var(--sui-space-5,1.25rem);padding:var(--sui-card-padding);border:var(--sui-card-border-width) solid var(--sui-card-border);border-radius:var(--sui-card-radius);background-color:var(--sui-card-bg);box-shadow:var(--sui-card-shadow);color:var(--sui-color-text,#111827)}.sui-card-Cb1o4[data-padding=sm]{--sui-card-padding:var(--sui-space-3,.75rem)}.sui-card-Cb1o4[data-padding=lg]{--sui-card-padding:var(--sui-space-8,2rem)}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { BoxElement, BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Inner spacing of a card, mapped to the `--sui-space-*` tokens
|
|
5
|
+
*/
|
|
6
|
+
export type CardPadding = "sm" | "md" | "lg";
|
|
7
|
+
interface CardOwnProps {
|
|
8
|
+
/**
|
|
9
|
+
* Inner spacing. Defaults to `md`.
|
|
10
|
+
*/
|
|
11
|
+
padding?: CardPadding;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Props for `Card`: its own props plus every prop supported by the element given in `as`
|
|
15
|
+
*/
|
|
16
|
+
export type CardProps<E extends BoxElement = "div"> = CardOwnProps & Omit<BoxProps<E>, keyof CardOwnProps>;
|
|
17
|
+
/**
|
|
18
|
+
* Raised surface that groups related content
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Card as="article" padding="lg">...</Card>
|
|
22
|
+
*/
|
|
23
|
+
export declare function Card<E extends BoxElement = "div">({ as, className, padding, ...rest }: CardProps<E>): JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Box as e } from "../Box/Box.js";
|
|
2
|
+
import t from "./Card.module.js";
|
|
3
|
+
import { clsx as n } from "clsx";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Card/Card.tsx
|
|
6
|
+
function i({ as: i, className: a, padding: o = "md", ...s }) {
|
|
7
|
+
return /* @__PURE__ */ r(e, {
|
|
8
|
+
...s,
|
|
9
|
+
as: i,
|
|
10
|
+
className: n(t.card, a),
|
|
11
|
+
"data-padding": o
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { i as Card };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-center-Pu1Pf{--sui-center-width:var(--sui-width-content,48rem);inline-size:100%;max-inline-size:calc(var(--sui-center-width) + 2 * var(--sui-center-gutter));padding-inline:var(--sui-center-gutter);margin-inline:auto}.sui-center-Pu1Pf[data-width=prose]{--sui-center-width:var(--sui-width-prose,65ch)}.sui-center-Pu1Pf[data-width=wide]{--sui-center-width:var(--sui-width-wide,72rem)}.sui-center-Pu1Pf[data-intrinsic]{flex-direction:column;align-items:center;display:flex}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import type { Space } from "../../layout";
|
|
3
|
+
import type { BoxElement, BoxProps } from "../Box";
|
|
4
|
+
/**
|
|
5
|
+
* Maximum column width, mapped to the `--sui-width-*` tokens
|
|
6
|
+
*/
|
|
7
|
+
export type CenterWidth = "prose" | "content" | "wide";
|
|
8
|
+
interface CenterOwnProps {
|
|
9
|
+
/**
|
|
10
|
+
* Inline padding that keeps content off the viewport edges. Defaults to `4`.
|
|
11
|
+
*/
|
|
12
|
+
gutter?: Space;
|
|
13
|
+
/**
|
|
14
|
+
* Also centres children narrower than the column. Defaults to `false`.
|
|
15
|
+
*/
|
|
16
|
+
intrinsic?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum width of the column. Defaults to `content`.
|
|
19
|
+
*/
|
|
20
|
+
width?: CenterWidth;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Props for `Center`: its own props plus every prop supported by the element given in `as`
|
|
24
|
+
*/
|
|
25
|
+
export type CenterProps<E extends BoxElement = "div"> = CenterOwnProps & Omit<BoxProps<E>, keyof CenterOwnProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Horizontally centred column with a maximum width and side gutters. Override a
|
|
28
|
+
* `--sui-width-*` token to change a width.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Center as="main" width="prose">...</Center>
|
|
32
|
+
*/
|
|
33
|
+
export declare function Center<E extends BoxElement = "div">({ as, className, gutter, intrinsic, width, ...rest }: CenterProps<E>): JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import r from "./Center.module.js";
|
|
5
|
+
import { clsx as i } from "clsx";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Center/Center.tsx
|
|
8
|
+
function o({ as: o, className: s, gutter: c = 4, intrinsic: l = !1, width: u = "content", ...d }) {
|
|
9
|
+
let { style: f, ...p } = d;
|
|
10
|
+
return /* @__PURE__ */ a(n, {
|
|
11
|
+
...p,
|
|
12
|
+
as: o,
|
|
13
|
+
className: i(r.center, s),
|
|
14
|
+
style: t({ "--sui-center-gutter": e(c) }, f),
|
|
15
|
+
"data-intrinsic": l ? "" : void 0,
|
|
16
|
+
"data-width": u
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { o as Center };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
/**
|
|
4
|
+
* Props for `Checkbox`: its own props plus every native input prop. `className` and `style` go to the wrapping
|
|
5
|
+
* label; `ref` and every other prop go to the input.
|
|
6
|
+
*/
|
|
7
|
+
export interface CheckboxProps extends Omit<BoxProps<"input">, "as" | "children" | "dangerouslySetInnerHTML" | "type"> {
|
|
8
|
+
/**
|
|
9
|
+
* Label shown beside the box, which names the checkbox. Without it, give the checkbox an accessible name, for
|
|
10
|
+
* example with `aria-label` or the `label` of the `Field` around it. It is inline content, as a `label` holds: a child
|
|
11
|
+
* laid out as a block drops below the box, so put a description after the checkbox, padded by `var(--sui-space-6)`.
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Themed native checkbox inside the label that names it. When it is required it shows an asterisk after its
|
|
17
|
+
* label. Inside a `Field` it takes its description, error, and required and disabled state from the field; give
|
|
18
|
+
* it either children or the field's `label`, not both.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <Checkbox name="updates">Send me product updates</Checkbox>
|
|
22
|
+
*/
|
|
23
|
+
export declare function Checkbox(props: CheckboxProps): JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChoiceControl as e } from "../ChoiceControl/ChoiceControl.js";
|
|
2
|
+
import { c as t } from "react/compiler-runtime";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = t(2), a;
|
|
7
|
+
return i[0] === r ? a = i[1] : (a = /* @__PURE__ */ n(e, {
|
|
8
|
+
...r,
|
|
9
|
+
kind: "checkbox"
|
|
10
|
+
}), i[0] = r, i[1] = a), a;
|
|
11
|
+
}
|
|
12
|
+
export { r as Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.sui-choiceControl-aSGqz{--sui-choice-control-size:var(--sui-space-4,1rem);--sui-choice-control-track-size:var(--sui-choice-control-size);--sui-choice-control-gap:var(--sui-space-2,.5rem);--_sui-choice-control-indent:calc(var(--sui-choice-control-track-size) + var(--sui-choice-control-gap));--sui-choice-control-bg:var(--sui-color-field,#fff);--sui-choice-control-border:var(--sui-color-input-border,#6b7280);--sui-choice-control-border-width:var(--sui-border-width,1px);--sui-choice-control-radius:var(--sui-radius-sm,2px);--sui-choice-control-fill:var(--sui-color-primary,#2563eb);--sui-choice-control-fill-border:var(--sui-color-control-border,transparent);--sui-choice-control-mark:var(--sui-color-on-primary,#fff);--sui-choice-control-mark-unchecked:var(--sui-choice-control-mark);--sui-choice-control-mark-size:calc(var(--sui-choice-control-size) * .6);--sui-choice-control-mark-shape:polygon(0% 56%, 12% 44%, 38% 70%, 88% 12%, 100% 22%, 38% 94%);--sui-choice-control-mark-radius:0;--sui-choice-control-mark-justify:center;--sui-choice-control-mark-inset:0;--sui-choice-control-mark-transform:none;--sui-choice-control-mark-transform-unchecked:scale(0);--sui-choice-control-spring:var(--sui-motion-spring,.12s ease-out);--sui-choice-control-halo-spread:var(--sui-choice-control-gap);--_sui-choice-control-halo-tint:var(--sui-color-text,#111827);text-align:start;text-indent:0;inline-size:fit-content;font-family:var(--sui-font-body,system-ui, sans-serif);line-height:var(--sui-line-height-normal,1.5);padding-block:max(0px,12px - .5lh);display:inline-block}.sui-choiceControl-aSGqz[data-kind=radio]{--sui-choice-control-radius:50%;--sui-choice-control-mark-size:calc(var(--sui-choice-control-size) * .4);--sui-choice-control-mark-shape:none;--sui-choice-control-mark-radius:50%}.sui-choiceControl-aSGqz[data-kind=switch]{--sui-choice-control-track-size:var(--sui-space-6,1.5rem);--sui-choice-control-radius:var(--sui-radius-full,9999px);--sui-choice-control-mark-unchecked:var(--sui-color-input-border,#6b7280);--sui-choice-control-mark-size:calc(var(--sui-choice-control-size) - 2 * var(--sui-choice-control-border-width) - 2 * var(--sui-choice-control-mark-inset));--sui-choice-control-mark-shape:none;--sui-choice-control-mark-radius:50%;--sui-choice-control-mark-justify:start;--sui-choice-control-mark-inset:.125rem;--sui-choice-control-mark-transform:translateX(calc(var(--sui-choice-control-track-size) - var(--sui-choice-control-size)));--sui-choice-control-mark-transform-unchecked:none}.sui-choiceControl-aSGqz.sui-withText-bNY-W{padding-inline-start:var(--_sui-choice-control-indent)}.sui-withText-bNY-W>.sui-input-DF-cI{margin-inline-start:calc(-1 * var(--_sui-choice-control-indent))}.sui-choiceControl-aSGqz[data-kind=switch]:dir(rtl){--sui-choice-control-mark-transform:translateX(calc(var(--sui-choice-control-size) - var(--sui-choice-control-track-size)))}.sui-input-DF-cI{--_sui-choice-control-halo:transparent;--_sui-choice-control-halo-hover:color-mix(in srgb, var(--_sui-choice-control-halo-tint) 8%, transparent);--_sui-choice-control-halo-press:color-mix(in srgb, var(--_sui-choice-control-halo-tint) 16%, transparent);align-content:center;justify-content:var(--sui-choice-control-mark-justify);inline-size:var(--sui-choice-control-track-size);block-size:var(--sui-choice-control-size);vertical-align:middle;font:inherit;border:var(--sui-choice-control-border-width) solid var(--sui-choice-control-border);border-radius:var(--sui-choice-control-radius);background-color:var(--sui-choice-control-bg);cursor:pointer;appearance:none;margin:0;margin-block-start:calc(.5ex - .5cap);transition:background-color .12s,border-color .12s,box-shadow .12s;display:inline-grid}.sui-input-DF-cI:before{inline-size:var(--sui-choice-control-mark-size);block-size:var(--sui-choice-control-mark-size);border-radius:var(--sui-choice-control-mark-radius);background-color:var(--sui-choice-control-mark-unchecked);content:"";clip-path:var(--sui-choice-control-mark-shape);transform:var(--sui-choice-control-mark-transform-unchecked);margin-inline-start:var(--sui-choice-control-mark-inset);transition:background-color .12s,transform .12s ease-out}.sui-input-DF-cI:checked{--sui-choice-control-bg:var(--sui-choice-control-fill);--sui-choice-control-border:var(--sui-choice-control-fill-border);--_sui-choice-control-halo-tint:var(--sui-choice-control-fill)}.sui-input-DF-cI:checked:before{background-color:var(--sui-choice-control-mark);transform:var(--sui-choice-control-mark-transform);transition:background-color .12s ease, transform var(--sui-choice-control-spring)}@media (hover:hover){.sui-choiceControl-aSGqz:hover .sui-input-DF-cI{--_sui-choice-control-halo:var(--_sui-choice-control-halo-hover)}}.sui-choiceControl-aSGqz:active .sui-input-DF-cI{--_sui-choice-control-halo:var(--_sui-choice-control-halo-press)}.sui-choiceControl-aSGqz .sui-input-DF-cI:focus-visible{--_sui-choice-control-halo:transparent;transition-property:background-color,border-color}.sui-input-DF-cI:enabled{box-shadow:0 0 0 var(--sui-choice-control-halo-spread) var(--_sui-choice-control-halo)}.sui-input-DF-cI:focus-visible{outline:var(--sui-focus-ring-width,2px) solid var(--sui-color-focus-ring,#3b82f6);outline-offset:2px}.sui-input-DF-cI[type=checkbox][aria-invalid=true],.sui-input-DF-cI[type=radio][data-invalid]{--sui-choice-control-border:var(--sui-color-danger-text,#b91c1c)}.sui-text-4-Caz{cursor:pointer;padding-inline-start:var(--sui-choice-control-gap)}.sui-input-DF-cI:disabled,.sui-input-DF-cI:disabled+.sui-text-4-Caz{cursor:not-allowed;opacity:.5}@media (prefers-reduced-motion:reduce){.sui-input-DF-cI:before,.sui-input-DF-cI:checked:before{transition:background-color .12s}}@media (forced-colors:active){.sui-choiceControl-aSGqz{--sui-choice-control-bg:Canvas;--sui-choice-control-border:CanvasText;--sui-choice-control-fill:Highlight;--sui-choice-control-fill-border:Highlight;--sui-choice-control-mark:HighlightText}.sui-choiceControl-aSGqz[data-kind=switch]{--sui-choice-control-mark-unchecked:CanvasText}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
|
+
import type { BoxProps } from "../Box";
|
|
3
|
+
type ChoiceControlKind = "checkbox" | "radio" | "switch";
|
|
4
|
+
interface ChoiceControlProps extends Omit<BoxProps<"input">, "as" | "children" | "dangerouslySetInnerHTML" | "type"> {
|
|
5
|
+
/**
|
|
6
|
+
* Label shown beside the control, which names it
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Control to draw. A switch is a checkbox input with the `switch` role, which replaces any `role` given.
|
|
11
|
+
*/
|
|
12
|
+
kind: ChoiceControlKind;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Themed native checkbox or radio input inside the `label` that names it, shared by `Checkbox`, `Switch` and
|
|
16
|
+
* `Radio`. `className` and `style` go to the label; `ref` and every other prop go to the input. Inside a `Field`
|
|
17
|
+
* the input takes its id, description, and invalid, disabled and required state from the field. A required
|
|
18
|
+
* checkbox or switch with a label shows an asterisk after it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ChoiceControl({ children, className, kind, role, style, ...inputProps }: ChoiceControlProps): JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hasContent as e } from "../../forms/hasContent.js";
|
|
2
|
+
import { useFieldControl as t } from "../../forms/useFieldControl.js";
|
|
3
|
+
import { Box as n } from "../Box/Box.js";
|
|
4
|
+
import { RequiredIndicator as r } from "../RequiredIndicator/RequiredIndicator.js";
|
|
5
|
+
import i from "./ChoiceControl.module.js";
|
|
6
|
+
import { clsx as a } from "clsx";
|
|
7
|
+
import { c as o } from "react/compiler-runtime";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
// src/components/ChoiceControl/ChoiceControl.tsx
|
|
10
|
+
function l(l) {
|
|
11
|
+
let u = o(31), d, f, p, m, h, g;
|
|
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);
|
|
13
|
+
let _ = t(p), v, y, b, x;
|
|
14
|
+
u[7] !== d || u[8] !== f ? (y = e(d), v = n, b = "label", x = a(i.choiceControl, { [i.withText]: y }, f), u[7] = d, u[8] = f, u[9] = v, u[10] = y, u[11] = b, u[12] = x) : (v = u[9], y = u[10], b = u[11], x = u[12]);
|
|
15
|
+
let S = m === "switch" ? "switch" : h, C = m === "radio" ? "radio" : "checkbox", w;
|
|
16
|
+
u[13] !== _ || u[14] !== p || u[15] !== S || u[16] !== C ? (w = /* @__PURE__ */ s(n, {
|
|
17
|
+
...p,
|
|
18
|
+
..._,
|
|
19
|
+
as: "input",
|
|
20
|
+
className: i.input,
|
|
21
|
+
role: S,
|
|
22
|
+
type: C
|
|
23
|
+
}), u[13] = _, u[14] = p, u[15] = S, u[16] = C, u[17] = w) : w = u[17];
|
|
24
|
+
let T;
|
|
25
|
+
u[18] !== d || u[19] !== _ || u[20] !== y || u[21] !== m ? (T = y && /* @__PURE__ */ c(n, {
|
|
26
|
+
as: "span",
|
|
27
|
+
className: i.text,
|
|
28
|
+
children: [d, _.required && m !== "radio" && /* @__PURE__ */ s(r, {})]
|
|
29
|
+
}), u[18] = d, u[19] = _, u[20] = y, u[21] = m, u[22] = T) : T = u[22];
|
|
30
|
+
let E;
|
|
31
|
+
return u[23] !== v || u[24] !== m || u[25] !== g || u[26] !== b || u[27] !== x || u[28] !== w || u[29] !== T ? (E = /* @__PURE__ */ c(v, {
|
|
32
|
+
as: b,
|
|
33
|
+
className: x,
|
|
34
|
+
style: g,
|
|
35
|
+
"data-kind": m,
|
|
36
|
+
children: [w, T]
|
|
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
|
+
}
|
|
39
|
+
export { l as ChoiceControl };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './ChoiceControl.css';// src/components/ChoiceControl/ChoiceControl.module.css
|
|
2
|
+
var e = "sui-choiceControl-aSGqz", t = "sui-withText-bNY-W", n = "sui-input-DF-cI", r = "sui-text-4-Caz", i = {
|
|
3
|
+
choiceControl: e,
|
|
4
|
+
withText: t,
|
|
5
|
+
input: n,
|
|
6
|
+
text: r
|
|
7
|
+
};
|
|
8
|
+
export { e as choiceControl, i as default, n as input, r as text, t as withText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChoiceControl } from "./ChoiceControl";
|