@astryxdesign/core 0.1.4-canary.ff77e1c → 0.1.4
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/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +18 -20
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -3
- package/dist/AppShell/AppShell.d.ts +1 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +53 -55
- package/dist/AspectRatio/AspectRatio.d.ts +10 -48
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +12 -33
- package/dist/AspectRatio/index.d.ts +1 -1
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +25 -27
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.js +5 -5
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +25 -32
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.js +7 -7
- package/dist/Button/Button.js +19 -19
- package/dist/ButtonGroup/ButtonGroup.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +48 -68
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +2 -2
- package/dist/Card/Card.d.ts +2 -4
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +10 -18
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +21 -24
- package/dist/Carousel/carousel.markers.stylex.d.ts +7 -0
- package/dist/Carousel/carousel.markers.stylex.d.ts.map +1 -0
- package/dist/Carousel/carousel.markers.stylex.js +12 -0
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.js +23 -23
- package/dist/Chat/ChatComposerDrawer.js +14 -14
- package/dist/Chat/ChatComposerInput.d.ts +1 -1
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +15 -27
- package/dist/Chat/ChatDictationButton.d.ts +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +11 -13
- package/dist/Chat/ChatLayout.js +17 -17
- package/dist/Chat/ChatLayoutScrollButton.d.ts +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +10 -12
- package/dist/Chat/ChatMessage.js +12 -12
- package/dist/Chat/ChatMessageBubble.js +7 -7
- package/dist/Chat/ChatMessageList.js +14 -14
- package/dist/Chat/ChatMessageMetadata.d.ts +1 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +12 -14
- package/dist/Chat/ChatPastedTextToken.js +13 -13
- package/dist/Chat/ChatSendButton.js +3 -3
- package/dist/Chat/ChatSystemMessage.d.ts +1 -1
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +17 -17
- package/dist/Chat/ChatTokenizedText.d.ts +1 -1
- package/dist/Chat/ChatTokenizedText.d.ts.map +1 -1
- package/dist/Chat/ChatTokenizedText.js +15 -24
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +74 -81
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -15
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +23 -25
- package/dist/CheckboxList/CheckboxList.js +9 -9
- package/dist/CheckboxList/CheckboxListItem.d.ts +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +6 -8
- package/dist/Citation/Citation.js +10 -10
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +9 -32
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts +1 -10
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +52 -88
- package/dist/Collapsible/Collapsible.d.ts +3 -9
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +22 -110
- package/dist/Collapsible/CollapsibleGroup.d.ts +7 -39
- package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroup.js +12 -73
- package/dist/Collapsible/CollapsibleGroupContext.d.ts +0 -31
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -33
- package/dist/Collapsible/index.d.ts +0 -1
- package/dist/Collapsible/index.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.d.ts +1 -4
- package/dist/Collapsible/useCollapsible.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.js +6 -20
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +34 -36
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.js +13 -13
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +2 -7
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +43 -76
- package/dist/DateInput/DateInput.js +18 -18
- package/dist/DateRangeInput/DateRangeInput.js +21 -21
- package/dist/DateTimeInput/DateTimeInput.d.ts +2 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +26 -30
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.js +16 -16
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.js +10 -10
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +17 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.js +29 -29
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.d.ts +3 -4
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +12 -29
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.d.ts +1 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +12 -16
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +11 -11
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +18 -18
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.d.ts +2 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +31 -44
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +31 -55
- package/dist/Lightbox/useLightbox.js +3 -3
- package/dist/Link/Link.js +15 -15
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +102 -102
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.d.ts +1 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +23 -26
- package/dist/MobileNav/MobileNavToggle.js +5 -5
- package/dist/MoreMenu/MoreMenu.js +3 -3
- package/dist/MultiSelector/MultiSelector.js +56 -56
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +32 -48
- package/dist/Outline/Outline.js +15 -15
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.js +3 -3
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +72 -125
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.js +7 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +92 -110
- package/dist/PowerSearch/PowerSearchEditPopover.js +84 -84
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.js +5 -5
- package/dist/PowerSearch/PowerSearchValueEditor.js +54 -54
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +18 -25
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +21 -24
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -28
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +10 -32
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +12 -18
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.js +46 -46
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +34 -38
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +6 -8
- package/dist/SideNav/SideNavHeading.js +87 -87
- package/dist/SideNav/SideNavItem.js +42 -42
- package/dist/SideNav/SideNavSection.d.ts +1 -1
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +16 -18
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts +4 -8
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -34
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.js +5 -5
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +30 -57
- package/dist/TabList/tab.markers.stylex.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -50
- package/dist/Table/Table.js +7 -7
- package/dist/Table/TableBody.d.ts +1 -1
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -9
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.d.ts +1 -1
- package/dist/Table/TableFooter.d.ts.map +1 -1
- package/dist/Table/TableFooter.js +5 -9
- package/dist/Table/TableHeader.d.ts +1 -1
- package/dist/Table/TableHeader.d.ts.map +1 -1
- package/dist/Table/TableHeader.js +5 -9
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +11 -14
- package/dist/Table/plugins/filtering/useTableFiltering.js +71 -71
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +1 -5
- package/dist/Table/plugins/pagination/useTablePagination.js +7 -7
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +22 -22
- package/dist/Table/plugins/selection/useTableSelection.js +18 -18
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.js +1 -11
- package/dist/Table/plugins/sortable/useTableSortable.js +17 -17
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -8
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.js +15 -15
- package/dist/Thumbnail/Thumbnail.d.ts +2 -3
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +29 -30
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +21 -26
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +26 -37
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +11 -23
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +4 -44
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.js +21 -21
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +34 -36
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.d.ts +1 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.js +32 -32
- package/dist/TopNav/TopNavHeading.js +67 -67
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +14 -25
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.js +8 -8
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.js +30 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +20 -23
- package/dist/Typeahead/Typeahead.js +12 -12
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/astryx.css +0 -7
- package/dist/astryx.umd.js +59 -59
- package/dist/astryx.umd.js.map +4 -4
- package/dist/docs-types.d.ts +2 -8
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.d.ts +1 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +1 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useFocusTrap.d.ts +0 -3
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -38
- package/dist/hooks/useInteractiveRole.d.ts +2 -6
- package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
- package/dist/hooks/useInteractiveRole.js +2 -6
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/hooks/useStreamingText.d.ts +1 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +5 -14
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +3 -10
- package/dist/theme/hct.d.ts +15 -0
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +9 -9
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/dist/theme/tokens.d.ts +2 -10
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +4 -220
- package/dist/theme/useTheme.d.ts +2 -3
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +6 -73
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -8
- package/package.json +3 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +0 -4
- package/src/AlertDialog/AlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.tsx +0 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +1 -28
- package/src/AspectRatio/AspectRatio.test.tsx +1 -142
- package/src/AspectRatio/AspectRatio.tsx +10 -70
- package/src/AspectRatio/index.ts +1 -5
- package/src/Avatar/Avatar.doc.mjs +0 -11
- package/src/Avatar/Avatar.test.tsx +1 -32
- package/src/Avatar/Avatar.tsx +20 -12
- package/src/AvatarGroup/AvatarGroup.doc.mjs +0 -1
- package/src/Banner/Banner.doc.mjs +0 -8
- package/src/Banner/Banner.test.tsx +0 -38
- package/src/Banner/Banner.tsx +1 -8
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +17 -122
- package/src/Calendar/Calendar.tsx +5 -26
- package/src/Calendar/dayCellUtils.ts +1 -3
- package/src/Calendar/styles.ts +2 -12
- package/src/Card/Card.doc.mjs +1 -1
- package/src/Card/Card.tsx +6 -16
- package/src/Carousel/Carousel.doc.mjs +12 -12
- package/src/Carousel/Carousel.test.tsx +0 -13
- package/src/Carousel/Carousel.tsx +2 -4
- package/src/Carousel/carousel.markers.stylex.ts +10 -0
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.test.tsx +1 -27
- package/src/Chat/ChatComposerInput.tsx +15 -20
- package/src/Chat/ChatDictationButton.tsx +4 -4
- package/src/Chat/ChatLayoutScrollButton.tsx +1 -3
- package/src/Chat/ChatMessageMetadata.tsx +6 -4
- package/src/Chat/ChatSystemMessage.test.tsx +11 -26
- package/src/Chat/ChatSystemMessage.tsx +7 -7
- package/src/Chat/ChatTokenizedText.test.tsx +16 -29
- package/src/Chat/ChatTokenizedText.tsx +8 -15
- package/src/Chat/ChatToolCalls.test.tsx +0 -55
- package/src/Chat/ChatToolCalls.tsx +12 -10
- package/src/Chat/index.ts +4 -1
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +4 -71
- package/src/CheckboxInput/CheckboxInput.tsx +0 -2
- package/src/CheckboxList/CheckboxList.test.tsx +0 -19
- package/src/CheckboxList/CheckboxListItem.tsx +2 -11
- package/src/Citation/Citation.doc.mjs +0 -5
- package/src/ClickableCard/ClickableCard.tsx +2 -45
- package/src/CodeBlock/CodeBlock.doc.mjs +2 -7
- package/src/CodeBlock/CodeBlock.test.tsx +3 -122
- package/src/CodeBlock/CodeBlock.tsx +4 -62
- package/src/Collapsible/Collapsible.doc.mjs +4 -8
- package/src/Collapsible/Collapsible.tsx +10 -86
- package/src/Collapsible/CollapsibleGroup.doc.mjs +3 -27
- package/src/Collapsible/CollapsibleGroup.test.tsx +0 -318
- package/src/Collapsible/CollapsibleGroup.tsx +9 -107
- package/src/Collapsible/CollapsibleGroupContext.tsx +2 -42
- package/src/Collapsible/index.ts +0 -4
- package/src/Collapsible/useCollapsible.ts +6 -20
- package/src/CommandPalette/CommandPalette.doc.mjs +0 -5
- package/src/CommandPalette/CommandPalette.tsx +3 -5
- package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +0 -5
- package/src/CommandPalette/CommandPaletteGroup.doc.mjs +0 -10
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteItem.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteList.doc.mjs +0 -9
- package/src/ContextMenu/ContextMenu.doc.mjs +0 -15
- package/src/ContextMenu/ContextMenu.test.tsx +0 -87
- package/src/ContextMenu/ContextMenu.tsx +28 -87
- package/src/ContextMenu/ContextMenuItem.doc.mjs +0 -6
- package/src/DateInput/DateInput.test.tsx +20 -11
- package/src/DateRangeInput/DateRangeInput.test.tsx +44 -31
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -3
- package/src/DateTimeInput/DateTimeInput.test.tsx +16 -118
- package/src/DateTimeInput/DateTimeInput.tsx +2 -8
- package/src/DateTimeInput/index.ts +0 -1
- package/src/Dialog/Dialog.doc.mjs +0 -4
- package/src/Dialog/DialogHeader.doc.mjs +0 -45
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +2 -22
- package/src/DropdownMenu/DropdownMenuItem.tsx +17 -5
- package/src/EmptyState/EmptyState.doc.mjs +1 -1
- package/src/Field/Field.test.tsx +4 -1
- package/src/Field/FieldLabel.test.tsx +2 -2
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +3 -0
- package/src/Grid/Grid.test.tsx +18 -43
- package/src/Grid/Grid.tsx +9 -26
- package/src/HoverCard/HoverCard.doc.mjs +6 -6
- package/src/HoverCard/useHoverCard.doc.mjs +5 -5
- package/src/HoverCard/useHoverCard.tsx +2 -9
- package/src/Icon/Icon.test.tsx +29 -41
- package/src/Icon/Icon.tsx +2 -6
- package/src/InputGroup/InputGroup.doc.mjs +0 -1
- package/src/InputGroup/InputGroup.tsx +2 -2
- package/src/Item/Item.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +2 -221
- package/src/Layer/useLayer.tsx +30 -69
- package/src/Layout/LayoutContent.doc.mjs +0 -12
- package/src/Layout/LayoutPanel.doc.mjs +0 -40
- package/src/Lightbox/Lightbox.doc.mjs +0 -5
- package/src/Lightbox/Lightbox.test.tsx +2 -123
- package/src/Lightbox/Lightbox.tsx +1 -29
- package/src/Markdown/Markdown.tsx +7 -9
- package/src/Markdown/parser.perf.test.ts +12 -34
- package/src/MobileNav/MobileNav.test.tsx +0 -56
- package/src/MobileNav/MobileNav.tsx +8 -13
- package/src/NavMenu/NavMenu.doc.mjs +0 -15
- package/src/NumberInput/NumberInput.test.tsx +3 -48
- package/src/NumberInput/NumberInput.tsx +15 -32
- package/src/Outline/Outline.doc.mjs +0 -2
- package/src/Overlay/Overlay.doc.mjs +0 -6
- package/src/Pagination/Pagination.test.tsx +0 -162
- package/src/Pagination/Pagination.tsx +26 -80
- package/src/Popover/Popover.doc.mjs +6 -6
- package/src/Popover/Popover.test.tsx +0 -65
- package/src/Popover/usePopover.doc.mjs +1 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.test.tsx +1 -109
- package/src/PowerSearch/PowerSearch.tsx +16 -37
- package/src/ProgressBar/ProgressBar.doc.mjs +0 -2
- package/src/ProgressBar/ProgressBar.test.tsx +0 -30
- package/src/ProgressBar/ProgressBar.tsx +5 -12
- package/src/RadioList/RadioList.test.tsx +0 -19
- package/src/RadioList/RadioListItem.tsx +4 -9
- package/src/Resizable/ResizeHandle.tsx +4 -22
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/SegmentedControl/SegmentedControl.test.tsx +0 -192
- package/src/SegmentedControl/SegmentedControl.tsx +5 -27
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -9
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.test.tsx +1 -27
- package/src/SideNav/SideNav.doc.mjs +1 -7
- package/src/SideNav/SideNav.test.tsx +0 -66
- package/src/SideNav/SideNav.tsx +2 -6
- package/src/SideNav/SideNavCollapseButton.tsx +3 -4
- package/src/SideNav/SideNavSection.tsx +4 -6
- package/src/Switch/Switch.doc.mjs +7 -7
- package/src/Switch/Switch.test.tsx +3 -102
- package/src/Switch/Switch.tsx +7 -20
- package/src/TabList/TabList.test.tsx +1 -185
- package/src/TabList/TabMenu.tsx +9 -45
- package/src/Table/BaseTable.tsx +2 -13
- package/src/Table/Table.doc.mjs +0 -5
- package/src/Table/Table.test.tsx +0 -87
- package/src/Table/TableBody.tsx +2 -15
- package/src/Table/TableFooter.tsx +2 -15
- package/src/Table/TableHeader.tsx +2 -15
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -13
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -3
- package/src/Table/plugins/pagination/paginateData.ts +1 -5
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -13
- package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -23
- package/src/Table/plugins/selection/useTableSelectionState.tsx +6 -11
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +1 -35
- package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -8
- package/src/TextArea/TextArea.test.tsx +3 -3
- package/src/TextInput/TextInput.test.tsx +3 -3
- package/src/Thumbnail/Thumbnail.test.tsx +2 -36
- package/src/Thumbnail/Thumbnail.tsx +2 -4
- package/src/TimeInput/TimeInput.test.tsx +0 -37
- package/src/TimeInput/TimeInput.tsx +1 -11
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +0 -52
- package/src/Timestamp/Timestamp.tsx +16 -30
- package/src/Toast/Toast.tsx +3 -11
- package/src/Toast/ToastViewport.test.tsx +0 -64
- package/src/Toast/ToastViewport.tsx +0 -12
- package/src/Toast/useToast.tsx +0 -41
- package/src/ToggleButton/ToggleButton.doc.mjs +0 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +0 -54
- package/src/Tokenizer/Tokenizer.tsx +4 -5
- package/src/Tooltip/Tooltip.doc.mjs +6 -6
- package/src/Tooltip/useTooltip.doc.mjs +5 -5
- package/src/Tooltip/useTooltip.tsx +2 -12
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.test.tsx +7 -23
- package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +2 -9
- package/src/TreeList/TreeList.doc.mjs +2 -2
- package/src/Typeahead/BaseTypeahead.doc.mjs +0 -19
- package/src/Typeahead/BaseTypeahead.tsx +2 -5
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.test.tsx +1 -45
- package/src/docs-types.ts +1 -9
- package/src/hooks/focusableSelector.ts +1 -1
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useFocusTrap.doc.mjs +2 -4
- package/src/hooks/useFocusTrap.test.tsx +1 -149
- package/src/hooks/useFocusTrap.ts +1 -50
- package/src/hooks/useInteractiveRole.ts +4 -12
- package/src/hooks/useStreamingText.test.ts +19 -54
- package/src/hooks/useStreamingText.ts +5 -16
- package/src/hooks/useTreeFocus.test.tsx +3 -1
- package/src/reset.css +0 -29
- package/src/theme/SyntaxTheme.doc.mjs +4 -4
- package/src/theme/defineTheme.ts +13 -4
- package/src/theme/derivedVarRegistry.test.ts +2 -2
- package/src/theme/expandColorScale.test.ts +0 -29
- package/src/theme/expandColorScale.ts +6 -11
- package/src/theme/hct.ts +17 -9
- package/src/theme/tokens.test.ts +9 -182
- package/src/theme/tokens.ts +4 -239
- package/src/theme/useTheme.test.tsx +2 -126
- package/src/theme/useTheme.ts +6 -87
- package/src/utils/index.ts +0 -4
- package/src/utils/sharedResizeObserver.test.ts +2 -2
- package/src/utils/timeParser.test.ts +0 -13
- package/src/utils/timeParser.ts +5 -8
- package/dist/hooks/useHotkeys.d.ts +0 -51
- package/dist/hooks/useHotkeys.d.ts.map +0 -1
- package/dist/hooks/useHotkeys.js +0 -160
- package/dist/utils/color.d.ts +0 -42
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js +0 -150
- package/dist/utils/composeEventHandlers.d.ts +0 -30
- package/dist/utils/composeEventHandlers.d.ts.map +0 -1
- package/dist/utils/composeEventHandlers.js +0 -40
- package/src/Chat/ChatDictationButton.test.tsx +0 -43
- package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -33
- package/src/Chat/ChatMessageMetadata.test.tsx +0 -32
- package/src/Collapsible/Collapsible.test.tsx +0 -405
- package/src/FieldStatus/FieldStatus.test.tsx +0 -282
- package/src/InteractiveRoleContext/InteractiveRoleContext.test.tsx +0 -185
- package/src/Layout/Layout.test.tsx +0 -285
- package/src/Layout/LayoutSlots.test.tsx +0 -364
- package/src/Outline/parseOutlineFromMarkdown.test.ts +0 -80
- package/src/OverflowList/OverflowList.test.tsx +0 -416
- package/src/Overlay/Overlay.test.tsx +0 -356
- package/src/Resizable/ResizeHandle.test.tsx +0 -218
- package/src/SizeContext/SizeContext.test.tsx +0 -226
- package/src/Toast/useToast.test.tsx +0 -258
- package/src/__tests__/TestIcon.tsx +0 -26
- package/src/__tests__/fastRoleQueries.ts +0 -66
- package/src/docPropReferences.test.ts +0 -178
- package/src/hooks/useHotkeys.doc.mjs +0 -52
- package/src/hooks/useHotkeys.test.ts +0 -245
- package/src/hooks/useHotkeys.ts +0 -203
- package/src/theme/themingTargets.test.ts +0 -353
- package/src/utils/color.test.ts +0 -133
- package/src/utils/color.ts +0 -148
- package/src/utils/composeEventHandlers.test.ts +0 -71
- package/src/utils/composeEventHandlers.ts +0 -44
- package/src/utils/mergeProps.test.ts +0 -166
|
@@ -4,28 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CodeBlock.tsx
|
|
7
|
-
* @input Uses React, StyleX, theme tokens, CSS Custom Highlight API
|
|
7
|
+
* @input Uses React, StyleX, theme tokens, CSS Custom Highlight API
|
|
8
8
|
* @output Exports CodeBlock component and CodeBlockProps
|
|
9
9
|
* @position Core implementation; read-only syntax-highlighted code display
|
|
10
10
|
*/
|
|
11
|
-
import { useInsertionEffect, useEffect,
|
|
11
|
+
import { useInsertionEffect, useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import * as stylex from '@stylexjs/stylex';
|
|
14
14
|
import "../theme/tokens.stylex.js";
|
|
15
15
|
import { colorVars, spacingVars, radiusVars, typographyVars, fontWeightVars, typeScaleVars, borderVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
16
16
|
import { mergeProps } from "../utils/index.js";
|
|
17
|
-
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
18
17
|
import { Icon } from "../Icon/index.js";
|
|
19
18
|
import { tokenize, tokenizeAsync, flatTokensToLines, SYNC_TOKENIZE_THRESHOLD } from "./tokenizer.js";
|
|
20
19
|
import { ensureHighlightStyles } from "./highlightStyles.js";
|
|
21
20
|
import { applyHighlightRangesChunked } from "./highlightRanges.js";
|
|
22
21
|
import { themeProps } from "../utils/themeProps.js";
|
|
23
|
-
import { SyntaxTheme } from "../theme/syntax/index.js";
|
|
24
22
|
|
|
25
23
|
// ---------------------------------------------------------------------------
|
|
26
24
|
// Styles
|
|
27
25
|
// ---------------------------------------------------------------------------
|
|
28
|
-
import {
|
|
26
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
27
|
const containerStyles = {
|
|
30
28
|
card: {
|
|
31
29
|
kaIpWk: "xh6dtrn",
|
|
@@ -133,10 +131,10 @@ const CodeChunk = /*#__PURE__*/React.memo(function CodeChunk({
|
|
|
133
131
|
highlightSet,
|
|
134
132
|
renderLineContent
|
|
135
133
|
}) {
|
|
136
|
-
return /*#__PURE__*/
|
|
134
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
137
135
|
children: lines.map((line, j) => {
|
|
138
136
|
const i = startIndex + j;
|
|
139
|
-
return /*#__PURE__*/
|
|
137
|
+
return /*#__PURE__*/_jsx("div", {
|
|
140
138
|
"data-line": i + 1,
|
|
141
139
|
...{
|
|
142
140
|
0: {
|
|
@@ -147,26 +145,26 @@ const CodeChunk = /*#__PURE__*/React.memo(function CodeChunk({
|
|
|
147
145
|
}
|
|
148
146
|
}[!!(highlightSet?.has(i + 1) ?? false) << 0],
|
|
149
147
|
children: renderLineContent(line, i)
|
|
150
|
-
}, i
|
|
148
|
+
}, i);
|
|
151
149
|
})
|
|
152
|
-
}
|
|
150
|
+
});
|
|
153
151
|
});
|
|
154
152
|
function renderLines(lines, highlightSet, renderLineContent, chunkSize = LINE_CHUNK_SIZE) {
|
|
155
153
|
chunkSize = Math.max(1, Math.floor(chunkSize));
|
|
156
154
|
if (lines.length < LINE_CHUNK_THRESHOLD) {
|
|
157
|
-
return /*#__PURE__*/
|
|
155
|
+
return /*#__PURE__*/_jsx(CodeChunk, {
|
|
158
156
|
lines: lines,
|
|
159
157
|
startIndex: 0,
|
|
160
158
|
highlightSet: highlightSet,
|
|
161
159
|
renderLineContent: renderLineContent
|
|
162
|
-
}
|
|
160
|
+
});
|
|
163
161
|
}
|
|
164
162
|
const chunks = [];
|
|
165
163
|
for (let start = 0; start < lines.length; start += chunkSize) {
|
|
166
164
|
const end = Math.min(start + chunkSize, lines.length);
|
|
167
165
|
const chunkLines = lines.slice(start, end);
|
|
168
166
|
const estimatedHeight = `${chunkLines.length}lh`;
|
|
169
|
-
chunks.push(/*#__PURE__*/
|
|
167
|
+
chunks.push(/*#__PURE__*/_jsx("div", {
|
|
170
168
|
...mergeProps({
|
|
171
169
|
className: "xb5mbof"
|
|
172
170
|
}, {
|
|
@@ -174,13 +172,13 @@ function renderLines(lines, highlightSet, renderLineContent, chunkSize = LINE_CH
|
|
|
174
172
|
containIntrinsicBlockSize: `auto ${estimatedHeight}`
|
|
175
173
|
}
|
|
176
174
|
}),
|
|
177
|
-
children: /*#__PURE__*/
|
|
175
|
+
children: /*#__PURE__*/_jsx(CodeChunk, {
|
|
178
176
|
lines: chunkLines,
|
|
179
177
|
startIndex: start,
|
|
180
178
|
highlightSet: highlightSet,
|
|
181
179
|
renderLineContent: renderLineContent
|
|
182
|
-
}
|
|
183
|
-
}, start
|
|
180
|
+
})
|
|
181
|
+
}, start));
|
|
184
182
|
}
|
|
185
183
|
return chunks;
|
|
186
184
|
}
|
|
@@ -278,10 +276,10 @@ function buildSpanLine(lineText, tokens) {
|
|
|
278
276
|
parts.push(lineText.slice(cursor, token.start));
|
|
279
277
|
}
|
|
280
278
|
const end = Math.min(token.end, lineText.length);
|
|
281
|
-
parts.push(/*#__PURE__*/
|
|
279
|
+
parts.push(/*#__PURE__*/_jsx("span", {
|
|
282
280
|
className: `astryx-token-${token.type} xds-token-${token.type}`,
|
|
283
281
|
children: lineText.slice(token.start, end)
|
|
284
|
-
}, `${token.start}-${token.type}
|
|
282
|
+
}, `${token.start}-${token.type}`));
|
|
285
283
|
cursor = end;
|
|
286
284
|
}
|
|
287
285
|
if (cursor < lineText.length) {
|
|
@@ -303,10 +301,10 @@ function SpanCodeContent({
|
|
|
303
301
|
const tokens = tokenLines[lineIndex] ?? [];
|
|
304
302
|
return buildSpanLine(line, tokens);
|
|
305
303
|
}, [tokenLines]);
|
|
306
|
-
return /*#__PURE__*/
|
|
304
|
+
return /*#__PURE__*/_jsx("code", {
|
|
307
305
|
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped),
|
|
308
306
|
children: renderLines(lines, highlightSet, renderLineContent)
|
|
309
|
-
}
|
|
307
|
+
});
|
|
310
308
|
}
|
|
311
309
|
|
|
312
310
|
// ---------------------------------------------------------------------------
|
|
@@ -333,11 +331,11 @@ function RangeCodeContent({
|
|
|
333
331
|
return applyHighlightRangesChunked(codeEl, tokenLines);
|
|
334
332
|
}, [tokenLines]);
|
|
335
333
|
const renderLineContent = useCallback(line => line || '\u200b', []);
|
|
336
|
-
return /*#__PURE__*/
|
|
334
|
+
return /*#__PURE__*/_jsx("code", {
|
|
337
335
|
ref: codeRef,
|
|
338
336
|
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped),
|
|
339
337
|
children: renderLines(lines, highlightSet, renderLineContent)
|
|
340
|
-
}
|
|
338
|
+
});
|
|
341
339
|
}
|
|
342
340
|
|
|
343
341
|
// ---------------------------------------------------------------------------
|
|
@@ -371,7 +369,6 @@ export function CodeBlock({
|
|
|
371
369
|
container = 'card',
|
|
372
370
|
tokenizer: customTokenizer,
|
|
373
371
|
highlightMode = 'auto',
|
|
374
|
-
syntaxTheme,
|
|
375
372
|
xstyle,
|
|
376
373
|
className,
|
|
377
374
|
style,
|
|
@@ -379,17 +376,6 @@ export function CodeBlock({
|
|
|
379
376
|
...props
|
|
380
377
|
}) {
|
|
381
378
|
const [copied, setCopied] = useState(false);
|
|
382
|
-
const copyResetTimerRef = useRef(null);
|
|
383
|
-
const announce = useAnnounce();
|
|
384
|
-
|
|
385
|
-
// Clear a pending "copied" reset when the block unmounts.
|
|
386
|
-
useEffect(() => {
|
|
387
|
-
return () => {
|
|
388
|
-
if (copyResetTimerRef.current != null) {
|
|
389
|
-
clearTimeout(copyResetTimerRef.current);
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}, []);
|
|
393
379
|
const useSpans = highlightMode === 'spans' || highlightMode === 'auto' && !hasHighlightAPI() || highlightMode === 'auto' && isSafari();
|
|
394
380
|
const lines = useMemo(() => {
|
|
395
381
|
const l = code.split('\n');
|
|
@@ -404,44 +390,28 @@ export function CodeBlock({
|
|
|
404
390
|
try {
|
|
405
391
|
await navigator.clipboard.writeText(code);
|
|
406
392
|
setCopied(true);
|
|
407
|
-
// Swapping the button's aria-label alone isn't reliably announced by
|
|
408
|
-
// screen readers, so confirm the copy via a polite live region.
|
|
409
|
-
announce('Copied');
|
|
410
393
|
onCopy?.();
|
|
411
|
-
|
|
412
|
-
// is reverted early by the previous click's timer.
|
|
413
|
-
if (copyResetTimerRef.current != null) {
|
|
414
|
-
clearTimeout(copyResetTimerRef.current);
|
|
415
|
-
}
|
|
416
|
-
copyResetTimerRef.current = setTimeout(() => {
|
|
417
|
-
copyResetTimerRef.current = null;
|
|
418
|
-
setCopied(false);
|
|
419
|
-
}, 2000);
|
|
394
|
+
setTimeout(() => setCopied(false), 2000);
|
|
420
395
|
} catch {
|
|
421
396
|
// Clipboard failures leave the copied state unchanged.
|
|
422
397
|
}
|
|
423
|
-
}, [code, onCopy
|
|
398
|
+
}, [code, onCopy]);
|
|
424
399
|
const sizeStyle = size === 'sm' ? styles.sizeSm : styles.sizeMd;
|
|
425
400
|
const gutterSizeStyle = size === 'sm' ? styles.gutterSm : styles.gutterMd;
|
|
426
401
|
const languageLabel = hasLanguageLabel && language !== 'plaintext' ? language : null;
|
|
427
402
|
const showHeader = title != null || languageLabel != null;
|
|
428
403
|
const canCollapse = isCollapsible && lines.length >= collapsibleThreshold;
|
|
429
404
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
430
|
-
// Links the collapsible header to the code region it shows/hides so assistive
|
|
431
|
-
// tech can move from the button to its controlled content (disclosure
|
|
432
|
-
// pattern). The region stays mounted when collapsed (CSS grid animation), so
|
|
433
|
-
// this is always a resolvable reference — aria-controls can be unconditional.
|
|
434
|
-
const regionId = useId();
|
|
435
405
|
const scrollContainerRef = useRef(null);
|
|
436
406
|
const scrollStyle = maxHeight ? {
|
|
437
407
|
maxHeight: typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight
|
|
438
408
|
} : undefined;
|
|
439
|
-
const copyIcon = /*#__PURE__*/
|
|
409
|
+
const copyIcon = /*#__PURE__*/_jsx(Icon, {
|
|
440
410
|
icon: copied ? 'check' : 'copy',
|
|
441
411
|
size: "sm",
|
|
442
412
|
color: "inherit"
|
|
443
|
-
}
|
|
444
|
-
const copyButtonEl = hasCopyButton ? /*#__PURE__*/
|
|
413
|
+
});
|
|
414
|
+
const copyButtonEl = hasCopyButton ? /*#__PURE__*/_jsx("button", {
|
|
445
415
|
type: "button",
|
|
446
416
|
onClick: e => {
|
|
447
417
|
// Stop propagation so copying does not toggle the collapsible header.
|
|
@@ -458,8 +428,8 @@ export function CodeBlock({
|
|
|
458
428
|
}
|
|
459
429
|
}[!!!showHeader << 0],
|
|
460
430
|
children: copyIcon
|
|
461
|
-
}
|
|
462
|
-
const headerEl = showHeader ? /*#__PURE__*/
|
|
431
|
+
}) : null;
|
|
432
|
+
const headerEl = showHeader ? /*#__PURE__*/_jsxs("div", {
|
|
463
433
|
...{
|
|
464
434
|
0: {
|
|
465
435
|
className: "x78zum5 x6s0dn4 x1qughib x1pzlopt xzyc27v x7wzq59 x13vifvy x1vjfegm xce4md1"
|
|
@@ -468,11 +438,10 @@ export function CodeBlock({
|
|
|
468
438
|
className: "x78zum5 x6s0dn4 x1qughib x1pzlopt xzyc27v x7wzq59 x13vifvy x1vjfegm xce4md1 x92x3c3 x1q0q8m5 xw8gpjh"
|
|
469
439
|
}
|
|
470
440
|
}[!!hasLineNumbers << 0],
|
|
471
|
-
children: [/*#__PURE__*/
|
|
441
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
472
442
|
role: canCollapse ? 'button' : undefined,
|
|
473
443
|
tabIndex: canCollapse ? 0 : undefined,
|
|
474
444
|
"aria-expanded": canCollapse ? !isCollapsed : undefined,
|
|
475
|
-
"aria-controls": canCollapse ? regionId : undefined,
|
|
476
445
|
onClick: canCollapse ? () => setIsCollapsed(prev => !prev) : undefined,
|
|
477
446
|
onKeyDown: canCollapse ? e => {
|
|
478
447
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -485,14 +454,14 @@ export function CodeBlock({
|
|
|
485
454
|
className: "x78zum5 x6s0dn4 x98rzlu xeuugli x1717udv xjbqb8w x1heor9g xln7xf2 x1yc453h"
|
|
486
455
|
},
|
|
487
456
|
1: {
|
|
488
|
-
className: "x78zum5 x6s0dn4 x98rzlu xeuugli x1717udv xjbqb8w x1heor9g xln7xf2 x1yc453h x1ypdohk x87ps6o
|
|
457
|
+
className: "x78zum5 x6s0dn4 x98rzlu xeuugli x1717udv xjbqb8w x1heor9g xln7xf2 x1yc453h x1ypdohk x87ps6o"
|
|
489
458
|
}
|
|
490
459
|
}[!!canCollapse << 0],
|
|
491
|
-
children: /*#__PURE__*/
|
|
460
|
+
children: /*#__PURE__*/_jsxs("span", {
|
|
492
461
|
...{
|
|
493
462
|
className: "x78zum5 x6s0dn4 xzye2dw x141an7d x9m5x89 x1e4wzip x1mjzq1q x1ghz6dp x1ltkj2j"
|
|
494
463
|
},
|
|
495
|
-
children: [title, title && languageLabel ? ' — ' : '', languageLabel, canCollapse && /*#__PURE__*/
|
|
464
|
+
children: [title, title && languageLabel ? ' — ' : '', languageLabel, canCollapse && /*#__PURE__*/_jsx("span", {
|
|
496
465
|
...{
|
|
497
466
|
0: {
|
|
498
467
|
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x6jxa94 x1v9usgg x1mjzq1q x11xpdln xuedmi6 xlr8y92"
|
|
@@ -501,16 +470,16 @@ export function CodeBlock({
|
|
|
501
470
|
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x6jxa94 x1v9usgg x1mjzq1q x11xpdln xuedmi6 xlr8y92 x19jd1h0"
|
|
502
471
|
}
|
|
503
472
|
}[!!isCollapsed << 0],
|
|
504
|
-
children: /*#__PURE__*/
|
|
473
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
505
474
|
icon: "chevronDown",
|
|
506
475
|
size: "xsm",
|
|
507
476
|
color: "inherit"
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
const codeBody = /*#__PURE__*/
|
|
477
|
+
})
|
|
478
|
+
})]
|
|
479
|
+
})
|
|
480
|
+
}), copyButtonEl]
|
|
481
|
+
}) : null;
|
|
482
|
+
const codeBody = /*#__PURE__*/_jsx("div", {
|
|
514
483
|
ref: scrollContainerRef
|
|
515
484
|
// The scroll container is keyboard-focusable so keyboard users can
|
|
516
485
|
// scroll long or wide code that overflows the viewport. Uses
|
|
@@ -525,7 +494,7 @@ export function CodeBlock({
|
|
|
525
494
|
}, {
|
|
526
495
|
style: scrollStyle
|
|
527
496
|
}),
|
|
528
|
-
children: /*#__PURE__*/
|
|
497
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
529
498
|
...{
|
|
530
499
|
0: {
|
|
531
500
|
className: "x78zum5 x1pshirs"
|
|
@@ -534,34 +503,34 @@ export function CodeBlock({
|
|
|
534
503
|
className: "x78zum5 x1pshirs x1ajqlyv"
|
|
535
504
|
}
|
|
536
505
|
}[!!(showHeader && !hasLineNumbers) << 0],
|
|
537
|
-
children: [hasLineNumbers && /*#__PURE__*/
|
|
506
|
+
children: [hasLineNumbers && /*#__PURE__*/_jsx("div", {
|
|
538
507
|
...stylex.props(styles.gutter, gutterSizeStyle),
|
|
539
508
|
"aria-hidden": "true",
|
|
540
509
|
children: lines.map((_, i) =>
|
|
541
510
|
/*#__PURE__*/
|
|
542
511
|
// eslint-disable-next-line @eslint-react/no-array-index-key -- gutter line numbers are positional by definition
|
|
543
|
-
|
|
512
|
+
_jsx("div", {
|
|
544
513
|
...{
|
|
545
514
|
className: "x9m5x89 x17iicif"
|
|
546
515
|
},
|
|
547
516
|
children: i + 1
|
|
548
|
-
}, i
|
|
549
|
-
}
|
|
517
|
+
}, i))
|
|
518
|
+
}), useSpans ? /*#__PURE__*/_jsx(SpanCodeContent, {
|
|
550
519
|
lines: lines,
|
|
551
520
|
tokenLines: tokenLines,
|
|
552
521
|
highlightSet: highlightSet,
|
|
553
522
|
isWrapped: isWrapped,
|
|
554
523
|
sizeStyle: sizeStyle
|
|
555
|
-
}
|
|
524
|
+
}) : /*#__PURE__*/_jsx(RangeCodeContent, {
|
|
556
525
|
lines: lines,
|
|
557
526
|
tokenLines: tokenLines,
|
|
558
527
|
highlightSet: highlightSet,
|
|
559
528
|
isWrapped: isWrapped,
|
|
560
529
|
sizeStyle: sizeStyle
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
530
|
+
})]
|
|
531
|
+
})
|
|
532
|
+
});
|
|
533
|
+
return /*#__PURE__*/_jsxs("pre", {
|
|
565
534
|
ref: ref,
|
|
566
535
|
...mergeProps(themeProps('codeblock', {
|
|
567
536
|
size,
|
|
@@ -569,8 +538,7 @@ export function CodeBlock({
|
|
|
569
538
|
container
|
|
570
539
|
}), stylex.props(styles.root, dynamicStyles.width(widthProp), containerStyles[container], xstyle), className, style),
|
|
571
540
|
...props,
|
|
572
|
-
children: [headerEl, canCollapse ? /*#__PURE__*/
|
|
573
|
-
id: regionId,
|
|
541
|
+
children: [headerEl, canCollapse ? /*#__PURE__*/_jsx("div", {
|
|
574
542
|
...{
|
|
575
543
|
0: {
|
|
576
544
|
className: "xrvj5dj x1tu4anv x1qn9uv2 x80gvsz xlr8y92"
|
|
@@ -579,17 +547,13 @@ export function CodeBlock({
|
|
|
579
547
|
className: "xrvj5dj x1qn9uv2 x80gvsz xlr8y92 xihq33y"
|
|
580
548
|
}
|
|
581
549
|
}[!!isCollapsed << 0],
|
|
582
|
-
children: /*#__PURE__*/
|
|
550
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
583
551
|
...{
|
|
584
552
|
className: "xb3r6kr x2lwn1j"
|
|
585
553
|
},
|
|
586
554
|
children: codeBody
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
return syntaxTheme ? /*#__PURE__*/_jsxDEV(SyntaxTheme, {
|
|
591
|
-
theme: syntaxTheme,
|
|
592
|
-
children: block
|
|
593
|
-
}, void 0, false) : block;
|
|
555
|
+
})
|
|
556
|
+
}) : codeBody, !showHeader && copyButtonEl]
|
|
557
|
+
});
|
|
594
558
|
}
|
|
595
559
|
CodeBlock.displayName = 'CodeBlock';
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Collapsible.tsx
|
|
3
|
-
* @input Uses React, StyleX, useCollapsible hook,
|
|
3
|
+
* @input Uses React, StyleX, useCollapsible hook, getIcon, theme tokens
|
|
4
4
|
* @output Exports Collapsible component and CollapsibleProps
|
|
5
5
|
* @position Collapsible content primitive — trigger toggles visibility of children
|
|
6
6
|
*
|
|
7
7
|
* Collapsible is a standalone primitive that makes any content collapsible.
|
|
8
8
|
* It renders a trigger area (always visible) and a content area that toggles.
|
|
9
|
-
* Handles state management, accessibility (aria-expanded
|
|
10
|
-
* the trigger to its content region), and chevron indicator.
|
|
9
|
+
* Handles state management, accessibility (aria-expanded), and chevron indicator.
|
|
11
10
|
*
|
|
12
11
|
* Works standalone or coordinated by CollapsibleGroup via the `value` prop.
|
|
13
|
-
* When the surrounding CollapsibleGroup enables `dividers`, each Collapsible
|
|
14
|
-
* draws its own row chrome (borderBlockStart suppressed on :first-child, plus
|
|
15
|
-
* density padding) from CollapsibleGroupPresentationContext — StyleX has no
|
|
16
|
-
* child selectors, so the group cannot draw it from outside. The presentation
|
|
17
|
-
* context is reset around children so nested collapsibles stay chrome-free.
|
|
18
12
|
*
|
|
19
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
20
14
|
* - /packages/core/src/Collapsible/index.ts (exports)
|
|
@@ -22,7 +16,7 @@
|
|
|
22
16
|
* - /apps/storybook/stories/Collapsible.stories.tsx
|
|
23
17
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
24
18
|
*/
|
|
25
|
-
import {
|
|
19
|
+
import type { ReactNode } from 'react';
|
|
26
20
|
import type { BaseProps } from '../BaseProps';
|
|
27
21
|
export interface CollapsibleProps extends BaseProps {
|
|
28
22
|
/** Ref forwarded to the root element */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAcrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsD5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,gBAAgB,EACxB,YAAY,EACZ,KAAK,EACL,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,+BA8ClB;yBA1De,WAAW"}
|
|
@@ -4,21 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Collapsible.tsx
|
|
7
|
-
* @input Uses React, StyleX, useCollapsible hook,
|
|
7
|
+
* @input Uses React, StyleX, useCollapsible hook, getIcon, theme tokens
|
|
8
8
|
* @output Exports Collapsible component and CollapsibleProps
|
|
9
9
|
* @position Collapsible content primitive — trigger toggles visibility of children
|
|
10
10
|
*
|
|
11
11
|
* Collapsible is a standalone primitive that makes any content collapsible.
|
|
12
12
|
* It renders a trigger area (always visible) and a content area that toggles.
|
|
13
|
-
* Handles state management, accessibility (aria-expanded
|
|
14
|
-
* the trigger to its content region), and chevron indicator.
|
|
13
|
+
* Handles state management, accessibility (aria-expanded), and chevron indicator.
|
|
15
14
|
*
|
|
16
15
|
* Works standalone or coordinated by CollapsibleGroup via the `value` prop.
|
|
17
|
-
* When the surrounding CollapsibleGroup enables `dividers`, each Collapsible
|
|
18
|
-
* draws its own row chrome (borderBlockStart suppressed on :first-child, plus
|
|
19
|
-
* density padding) from CollapsibleGroupPresentationContext — StyleX has no
|
|
20
|
-
* child selectors, so the group cannot draw it from outside. The presentation
|
|
21
|
-
* context is reset around children so nested collapsibles stay chrome-free.
|
|
22
16
|
*
|
|
23
17
|
* SYNC: When modified, update these files to stay in sync:
|
|
24
18
|
* - /packages/core/src/Collapsible/index.ts (exports)
|
|
@@ -26,93 +20,20 @@
|
|
|
26
20
|
* - /apps/storybook/stories/Collapsible.stories.tsx
|
|
27
21
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
28
22
|
*/
|
|
29
|
-
import { use, useId } from 'react';
|
|
30
23
|
import * as stylex from '@stylexjs/stylex';
|
|
31
24
|
import "../theme/tokens.stylex.js";
|
|
32
|
-
import {
|
|
25
|
+
import { colorVars, typographyVars, fontWeightVars, spacingVars, typeScaleVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
33
26
|
import { useCollapsible } from "./useCollapsible.js";
|
|
34
|
-
import { CollapsibleGroupPresentationContext } from "./CollapsibleGroupContext.js";
|
|
35
27
|
import { getIcon } from "../Icon/globalIconRegistry.js";
|
|
36
28
|
import { mergeProps } from "../utils/index.js";
|
|
37
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
38
|
-
import {
|
|
30
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
31
|
const styles = {
|
|
40
32
|
root: {
|
|
41
33
|
kzqmXN: "xh8yej3",
|
|
42
34
|
$$css: true
|
|
43
|
-
},
|
|
44
|
-
trigger: {
|
|
45
|
-
kB7OPa: "x9f619",
|
|
46
|
-
k1xSpc: "x78zum5",
|
|
47
|
-
kGNEyG: "x6s0dn4",
|
|
48
|
-
kjj79g: "x1qughib",
|
|
49
|
-
kzqmXN: "xh8yej3",
|
|
50
|
-
kkrTdU: "x1ypdohk",
|
|
51
|
-
kMv6JI: "x9ynric",
|
|
52
|
-
kGuDYH: "x18juvz8",
|
|
53
|
-
k63SB2: "x2mo6ok",
|
|
54
|
-
kMwMTN: "x1tgivj0",
|
|
55
|
-
k9WMMc: "x1yc453h",
|
|
56
|
-
k8WAf4: "xt970qd",
|
|
57
|
-
kI3sdo: "x17nn4n9",
|
|
58
|
-
kInvED: "x1wfwxd8 x7s97pk",
|
|
59
|
-
$$css: true
|
|
60
|
-
},
|
|
61
|
-
contentHidden: {
|
|
62
|
-
k1xSpc: "x1s85apg",
|
|
63
|
-
$$css: true
|
|
64
|
-
},
|
|
65
|
-
content: {
|
|
66
|
-
kLKAdn: "xfsso4q",
|
|
67
|
-
$$css: true
|
|
68
|
-
},
|
|
69
|
-
divided: {
|
|
70
|
-
kEafiO: "x11xkdxz x1g31smg",
|
|
71
|
-
kPef9Z: "x13fuv20",
|
|
72
|
-
kLZC3w: "x1pc3f07",
|
|
73
|
-
$$css: true
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Density padding for divided/padded accordion rows. paddingBlock mapping
|
|
78
|
-
// follows Table's density scale (spacing-1/2/3); content only pads its end
|
|
79
|
-
// so text doesn't sit on the divider below (block-start stays spacing-1).
|
|
80
|
-
const densityStyles = {
|
|
81
|
-
triggerCompact: {
|
|
82
|
-
k8WAf4: "xu0wf1k",
|
|
83
|
-
$$css: true
|
|
84
|
-
},
|
|
85
|
-
triggerBalanced: {
|
|
86
|
-
k8WAf4: "xce4md1",
|
|
87
|
-
$$css: true
|
|
88
|
-
},
|
|
89
|
-
triggerSpacious: {
|
|
90
|
-
k8WAf4: "x8o8v82",
|
|
91
|
-
$$css: true
|
|
92
|
-
},
|
|
93
|
-
contentCompact: {
|
|
94
|
-
kGO01o: "xy143xn",
|
|
95
|
-
$$css: true
|
|
96
|
-
},
|
|
97
|
-
contentBalanced: {
|
|
98
|
-
kGO01o: "x1wesfrj",
|
|
99
|
-
$$css: true
|
|
100
|
-
},
|
|
101
|
-
contentSpacious: {
|
|
102
|
-
kGO01o: "xvmdzux",
|
|
103
|
-
$$css: true
|
|
104
35
|
}
|
|
105
36
|
};
|
|
106
|
-
const triggerDensity = {
|
|
107
|
-
compact: densityStyles.triggerCompact,
|
|
108
|
-
balanced: densityStyles.triggerBalanced,
|
|
109
|
-
spacious: densityStyles.triggerSpacious
|
|
110
|
-
};
|
|
111
|
-
const contentDensity = {
|
|
112
|
-
compact: densityStyles.contentCompact,
|
|
113
|
-
balanced: densityStyles.contentBalanced,
|
|
114
|
-
spacious: densityStyles.contentSpacious
|
|
115
|
-
};
|
|
116
37
|
/**
|
|
117
38
|
* A primitive that makes any content collapsible.
|
|
118
39
|
*
|
|
@@ -178,33 +99,24 @@ export function Collapsible({
|
|
|
178
99
|
isCollapsible: collapsibleConfig,
|
|
179
100
|
value
|
|
180
101
|
});
|
|
181
|
-
const presentation = use(CollapsibleGroupPresentationContext);
|
|
182
|
-
const isDivided = presentation != null && presentation.dividers !== 'none';
|
|
183
|
-
const density = presentation?.density ?? null;
|
|
184
102
|
const chevronIcon = getIcon('chevronDown');
|
|
185
|
-
|
|
186
|
-
// Links the trigger to the region it shows/hides so assistive tech can move
|
|
187
|
-
// from the button to its controlled content (disclosure pattern).
|
|
188
|
-
const contentId = useId();
|
|
189
|
-
return /*#__PURE__*/_jsxDEV("div", {
|
|
103
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
190
104
|
ref: ref,
|
|
191
|
-
...mergeProps(themeProps('collapsible',
|
|
192
|
-
dividers: isDivided ? presentation.dividers : undefined,
|
|
193
|
-
density: density ?? undefined
|
|
194
|
-
}), stylex.props(styles.root, isDivided && styles.divided, xstyle), className, style),
|
|
105
|
+
...mergeProps(themeProps('collapsible'), stylex.props(styles.root, xstyle), className, style),
|
|
195
106
|
...props,
|
|
196
|
-
children: [/*#__PURE__*/
|
|
107
|
+
children: [/*#__PURE__*/_jsxs("button", {
|
|
197
108
|
type: "button",
|
|
198
109
|
onClick: toggle,
|
|
199
110
|
"aria-expanded": isOpen,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
111
|
+
...{
|
|
112
|
+
className: "x9f619 x78zum5 x6s0dn4 x1qughib xh8yej3 x1ypdohk x9ynric x18juvz8 x2mo6ok x1tgivj0 x1yc453h xt970qd"
|
|
113
|
+
},
|
|
114
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
203
115
|
...{
|
|
204
116
|
className: "x1b2iylo xwgcxoh"
|
|
205
117
|
},
|
|
206
118
|
children: trigger
|
|
207
|
-
}
|
|
119
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
208
120
|
...{
|
|
209
121
|
0: {
|
|
210
122
|
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s x11xpdln xuedmi6 xlr8y92 xv9yike x7p49u4"
|
|
@@ -214,15 +126,15 @@ export function Collapsible({
|
|
|
214
126
|
}
|
|
215
127
|
}[!!isOpen << 0],
|
|
216
128
|
children: chevronIcon
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
}
|
|
129
|
+
})]
|
|
130
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
131
|
+
...(isOpen ? {
|
|
132
|
+
className: "xfsso4q"
|
|
133
|
+
} : {
|
|
134
|
+
className: "xfsso4q x1s85apg"
|
|
135
|
+
}),
|
|
136
|
+
children: children
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
227
139
|
}
|
|
228
140
|
Collapsible.displayName = 'Collapsible';
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file CollapsibleGroup.tsx
|
|
3
|
-
* @input Uses React useState, useCallback, CollapsibleGroupContext
|
|
3
|
+
* @input Uses React useState, useCallback, CollapsibleGroupContext
|
|
4
4
|
* @output Exports CollapsibleGroup component and CollapsibleGroupProps
|
|
5
|
-
* @position Core collapsible group coordination provider — renders no wrapper
|
|
6
|
-
* DOM unless `dividers` is enabled
|
|
5
|
+
* @position Core collapsible group coordination provider — renders no wrapper DOM
|
|
7
6
|
*
|
|
8
7
|
* CollapsibleGroup groups collapsible components (Card, etc.) with
|
|
9
|
-
* coordinated open/close behavior.
|
|
10
|
-
*
|
|
11
|
-
* wrapper div that anchors the divider chrome (outer borders, reliable
|
|
12
|
-
* :first-child suppression) and provides dividers/density to items via
|
|
13
|
-
* CollapsibleGroupPresentationContext — each Collapsible draws its own
|
|
14
|
-
* borders since StyleX has no child selectors.
|
|
8
|
+
* coordinated open/close behavior. It renders only `{children}` — no wrapper
|
|
9
|
+
* DOM element.
|
|
15
10
|
*
|
|
16
11
|
* In "single" mode (default), only one item can be open at a time.
|
|
17
12
|
* In "multiple" mode, any number of items can be open simultaneously.
|
|
@@ -24,7 +19,6 @@
|
|
|
24
19
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
25
20
|
*/
|
|
26
21
|
import React, { type ReactNode } from 'react';
|
|
27
|
-
import type { CollapsibleGroupDensity, CollapsibleGroupDividers } from './CollapsibleGroupContext';
|
|
28
22
|
import type { BaseProps } from '../BaseProps';
|
|
29
23
|
export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
30
24
|
ref?: React.Ref<HTMLElement>;
|
|
@@ -47,22 +41,6 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
47
41
|
* Callback when the open item(s) change.
|
|
48
42
|
*/
|
|
49
43
|
onChange?: (value: string | string[]) => void;
|
|
50
|
-
/**
|
|
51
|
-
* Divider style rendered around the group's items — the accordion row
|
|
52
|
-
* chrome. 'between' draws hairlines between adjacent items; 'all' adds the
|
|
53
|
-
* group's top and bottom edges. When enabled, the group renders a wrapper
|
|
54
|
-
* div (it otherwise renders no DOM) and items get 'balanced' density unless
|
|
55
|
-
* `density` says otherwise. Pair with bare Collapsible children; Card-wrapped
|
|
56
|
-
* items provide their own separation.
|
|
57
|
-
* @default "none"
|
|
58
|
-
*/
|
|
59
|
-
dividers?: CollapsibleGroupDividers;
|
|
60
|
-
/**
|
|
61
|
-
* Row density controlling trigger and content block padding on the group's
|
|
62
|
-
* items. Defaults to 'balanced' when dividers are shown; otherwise items
|
|
63
|
-
* keep their default unpadded look.
|
|
64
|
-
*/
|
|
65
|
-
density?: CollapsibleGroupDensity;
|
|
66
44
|
/**
|
|
67
45
|
* Children — any components that support isCollapsible + value.
|
|
68
46
|
*
|
|
@@ -91,26 +69,16 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
91
69
|
}
|
|
92
70
|
/**
|
|
93
71
|
* Groups collapsible components with coordinated open/close behavior.
|
|
94
|
-
* Renders no wrapper DOM
|
|
72
|
+
* Renders no wrapper DOM.
|
|
95
73
|
*
|
|
96
74
|
* In "single" mode (default), opening one item closes the others.
|
|
97
75
|
* In "multiple" mode, items toggle independently.
|
|
98
76
|
*
|
|
99
77
|
* @compositionHint Wrap Collapsible instances to coordinate their open/close state.
|
|
100
|
-
* Each Collapsible needs a `value` prop to participate.
|
|
101
|
-
* use `dividers` with bare Collapsible children instead of wrapping each item
|
|
102
|
-
* in Card.
|
|
78
|
+
* Each Collapsible needs a `value` prop to participate.
|
|
103
79
|
*
|
|
104
80
|
* @example
|
|
105
81
|
* ```
|
|
106
|
-
* <CollapsibleGroup type="single" dividers="between" defaultValue="faq1">
|
|
107
|
-
* <Collapsible trigger="What is Astryx?" value="faq1">
|
|
108
|
-
* Astryx is a design system for building internal tools.
|
|
109
|
-
* </Collapsible>
|
|
110
|
-
* <Collapsible trigger="How do I start?" value="faq2">
|
|
111
|
-
* Install the package and import components.
|
|
112
|
-
* </Collapsible>
|
|
113
|
-
* </CollapsibleGroup>
|
|
114
82
|
* <CollapsibleGroup type="single" defaultValue="faq1">
|
|
115
83
|
* <VStack gap={2}>
|
|
116
84
|
* <Card>
|
|
@@ -127,7 +95,7 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
127
95
|
* </CollapsibleGroup>
|
|
128
96
|
* ```
|
|
129
97
|
*/
|
|
130
|
-
export declare function CollapsibleGroup({ type, defaultValue, value: controlledValue, onChange,
|
|
98
|
+
export declare function CollapsibleGroup({ type, defaultValue, value: controlledValue, onChange, children, }: CollapsibleGroupProps): React.JSX.Element;
|
|
131
99
|
export declare namespace CollapsibleGroup {
|
|
132
100
|
var displayName: string;
|
|
133
101
|
}
|