@gnome-ui/react 1.45.1 → 1.46.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/dist/components/AboutDialog/AboutDialog.cjs +1 -1
- package/dist/components/AboutDialog/AboutDialog.cjs.map +1 -1
- package/dist/components/AboutDialog/AboutDialog.d.ts +1 -1
- package/dist/components/AboutDialog/AboutDialog.js +106 -108
- package/dist/components/AboutDialog/AboutDialog.js.map +1 -1
- package/dist/components/AboutDialog/AboutDialog.module.css.cjs +1 -1
- package/dist/components/AboutDialog/AboutDialog.module.css.js +28 -29
- package/dist/components/AboutDialog.cjs +1 -1
- package/dist/components/ActionRow/ActionRow.cjs +1 -1
- package/dist/components/ActionRow/ActionRow.cjs.map +1 -1
- package/dist/components/ActionRow/ActionRow.d.ts +1 -1
- package/dist/components/ActionRow/ActionRow.js +2 -2
- package/dist/components/ActionRow/ActionRow.js.map +1 -1
- package/dist/components/ActionRow.cjs +1 -1
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/AvatarRotator/AvatarRotator.cjs +1 -1
- package/dist/components/AvatarRotator/AvatarRotator.cjs.map +1 -1
- package/dist/components/AvatarRotator/AvatarRotator.d.ts +1 -1
- package/dist/components/AvatarRotator/AvatarRotator.js +2 -2
- package/dist/components/AvatarRotator/AvatarRotator.js.map +1 -1
- package/dist/components/AvatarRotator.cjs +1 -1
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.cjs.map +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Banner/Banner.cjs +1 -1
- package/dist/components/Banner/Banner.cjs.map +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/Banner/Banner.js +34 -36
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Banner/Banner.module.css.cjs +1 -1
- package/dist/components/Banner/Banner.module.css.js +11 -12
- package/dist/components/Banner.cjs +1 -1
- package/dist/components/Bin/Bin.cjs +1 -1
- package/dist/components/Bin/Bin.cjs.map +1 -1
- package/dist/components/Bin/Bin.d.ts +1 -1
- package/dist/components/Bin/Bin.js +4 -6
- package/dist/components/Bin/Bin.js.map +1 -1
- package/dist/components/Bin.cjs +1 -1
- package/dist/components/Blockquote/Blockquote.cjs +1 -1
- package/dist/components/Blockquote/Blockquote.cjs.map +1 -1
- package/dist/components/Blockquote/Blockquote.d.ts +1 -1
- package/dist/components/Blockquote/Blockquote.js +24 -26
- package/dist/components/Blockquote/Blockquote.js.map +1 -1
- package/dist/components/Blockquote.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +37 -38
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.css.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.module.css.js +8 -9
- package/dist/components/BottomSheet.cjs +1 -1
- package/dist/components/Box/Box.cjs +1 -1
- package/dist/components/Box/Box.cjs.map +1 -1
- package/dist/components/Box/Box.d.ts +1 -1
- package/dist/components/Box/Box.js +2 -2
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Box.cjs +1 -1
- package/dist/components/BoxedList/BoxedList.cjs +1 -1
- package/dist/components/BoxedList/BoxedList.cjs.map +1 -1
- package/dist/components/BoxedList/BoxedList.d.ts +1 -1
- package/dist/components/BoxedList/BoxedList.js +2 -2
- package/dist/components/BoxedList/BoxedList.js.map +1 -1
- package/dist/components/BoxedList.cjs +1 -1
- package/dist/components/BreakpointBin/BreakpointBin.cjs +1 -1
- package/dist/components/BreakpointBin/BreakpointBin.cjs.map +1 -1
- package/dist/components/BreakpointBin/BreakpointBin.d.ts +1 -1
- package/dist/components/BreakpointBin/BreakpointBin.js +2 -2
- package/dist/components/BreakpointBin/BreakpointBin.js.map +1 -1
- package/dist/components/BreakpointBin.cjs +1 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button.cjs +1 -1
- package/dist/components/ButtonContent/ButtonContent.cjs +1 -1
- package/dist/components/ButtonContent/ButtonContent.cjs.map +1 -1
- package/dist/components/ButtonContent/ButtonContent.d.ts +1 -1
- package/dist/components/ButtonContent/ButtonContent.js +24 -26
- package/dist/components/ButtonContent/ButtonContent.js.map +1 -1
- package/dist/components/ButtonContent.cjs +1 -1
- package/dist/components/ButtonRow/ButtonRow.cjs +1 -1
- package/dist/components/ButtonRow/ButtonRow.cjs.map +1 -1
- package/dist/components/ButtonRow/ButtonRow.d.ts +1 -1
- package/dist/components/ButtonRow/ButtonRow.js +22 -24
- package/dist/components/ButtonRow/ButtonRow.js.map +1 -1
- package/dist/components/ButtonRow.cjs +1 -1
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +10 -12
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.module.css.cjs +1 -1
- package/dist/components/Card/Card.module.css.js +4 -5
- package/dist/components/Card.cjs +1 -1
- package/dist/components/Carousel/Carousel.cjs +1 -1
- package/dist/components/Carousel/Carousel.cjs.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +3 -3
- package/dist/components/Carousel/Carousel.js +28 -34
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel.cjs +1 -1
- package/dist/components/CheckRow/CheckRow.cjs +1 -1
- package/dist/components/CheckRow/CheckRow.cjs.map +1 -1
- package/dist/components/CheckRow/CheckRow.d.ts +1 -1
- package/dist/components/CheckRow/CheckRow.js +7 -7
- package/dist/components/CheckRow/CheckRow.js.map +1 -1
- package/dist/components/CheckRow.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox.cjs +1 -1
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.cjs.map +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Chip/Chip.js +2 -2
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip.cjs +1 -1
- package/dist/components/Clamp/Clamp.cjs +1 -1
- package/dist/components/Clamp/Clamp.cjs.map +1 -1
- package/dist/components/Clamp/Clamp.d.ts +1 -1
- package/dist/components/Clamp/Clamp.js +9 -11
- package/dist/components/Clamp/Clamp.js.map +1 -1
- package/dist/components/Clamp.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -2
- package/dist/components/ColorPicker/ColorPicker.js +33 -37
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.module.css.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.module.css.js +9 -10
- package/dist/components/ColorPicker.cjs +1 -1
- package/dist/components/ColumnView/ColumnView.cjs +1 -1
- package/dist/components/ColumnView/ColumnView.cjs.map +1 -1
- package/dist/components/ColumnView/ColumnView.d.ts +1 -1
- package/dist/components/ColumnView/ColumnView.js +24 -28
- package/dist/components/ColumnView/ColumnView.js.map +1 -1
- package/dist/components/ColumnView.cjs +1 -1
- package/dist/components/ComboRow/ComboRow.cjs +1 -1
- package/dist/components/ComboRow/ComboRow.cjs.map +1 -1
- package/dist/components/ComboRow/ComboRow.d.ts +1 -1
- package/dist/components/ComboRow/ComboRow.js +2 -2
- package/dist/components/ComboRow/ComboRow.js.map +1 -1
- package/dist/components/ComboRow/ComboRow.module.css.cjs +1 -1
- package/dist/components/ComboRow/ComboRow.module.css.js +24 -25
- package/dist/components/ComboRow.cjs +1 -1
- package/dist/components/ContributionGraph/ContributionGraph.cjs +1 -1
- package/dist/components/ContributionGraph/ContributionGraph.cjs.map +1 -1
- package/dist/components/ContributionGraph/ContributionGraph.d.ts +1 -1
- package/dist/components/ContributionGraph/ContributionGraph.js +2 -2
- package/dist/components/ContributionGraph/ContributionGraph.js.map +1 -1
- package/dist/components/ContributionGraph.cjs +1 -1
- package/dist/components/CountDownTimer/CountDownTimer.cjs +1 -1
- package/dist/components/CountDownTimer/CountDownTimer.cjs.map +1 -1
- package/dist/components/CountDownTimer/CountDownTimer.d.ts +1 -1
- package/dist/components/CountDownTimer/CountDownTimer.js +2 -2
- package/dist/components/CountDownTimer/CountDownTimer.js.map +1 -1
- package/dist/components/CountDownTimer.cjs +1 -1
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +51 -52
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Dialog.module.css.cjs +1 -1
- package/dist/components/Dialog/Dialog.module.css.js +8 -9
- package/dist/components/Dialog/dialogUtils.cjs +1 -1
- package/dist/components/Dialog/dialogUtils.cjs.map +1 -1
- package/dist/components/Dialog/dialogUtils.d.ts +6 -0
- package/dist/components/Dialog/dialogUtils.js +11 -2
- package/dist/components/Dialog/dialogUtils.js.map +1 -1
- package/dist/components/Dialog.cjs +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.module.css.cjs +1 -1
- package/dist/components/Drawer/Drawer.module.css.js +11 -12
- package/dist/components/Drawer.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.cjs.map +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.js +89 -85
- package/dist/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.module.css.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.module.css.js +20 -21
- package/dist/components/Dropdown.cjs +1 -1
- package/dist/components/EntryRow/EntryRow.cjs +1 -1
- package/dist/components/EntryRow/EntryRow.cjs.map +1 -1
- package/dist/components/EntryRow/EntryRow.d.ts +1 -1
- package/dist/components/EntryRow/EntryRow.js +2 -2
- package/dist/components/EntryRow/EntryRow.js.map +1 -1
- package/dist/components/EntryRow.cjs +1 -1
- package/dist/components/ExpanderRow/ExpanderRow.cjs +1 -1
- package/dist/components/ExpanderRow/ExpanderRow.cjs.map +1 -1
- package/dist/components/ExpanderRow/ExpanderRow.d.ts +1 -1
- package/dist/components/ExpanderRow/ExpanderRow.js +2 -2
- package/dist/components/ExpanderRow/ExpanderRow.js.map +1 -1
- package/dist/components/ExpanderRow.cjs +1 -1
- package/dist/components/Footer/Footer.cjs +1 -1
- package/dist/components/Footer/Footer.cjs.map +1 -1
- package/dist/components/Footer/Footer.d.ts +1 -1
- package/dist/components/Footer/Footer.js +22 -24
- package/dist/components/Footer/Footer.js.map +1 -1
- package/dist/components/Footer.cjs +1 -1
- package/dist/components/Frame/Frame.cjs +1 -1
- package/dist/components/Frame/Frame.cjs.map +1 -1
- package/dist/components/Frame/Frame.d.ts +1 -1
- package/dist/components/Frame/Frame.js +5 -7
- package/dist/components/Frame/Frame.js.map +1 -1
- package/dist/components/Frame.cjs +1 -1
- package/dist/components/GnomeProvider/GnomeContext.cjs +1 -1
- package/dist/components/GnomeProvider/GnomeContext.cjs.map +1 -1
- package/dist/components/GnomeProvider/GnomeContext.js.map +1 -1
- package/dist/components/GnomeProvider/GnomeProvider.cjs +1 -1
- package/dist/components/GnomeProvider/GnomeProvider.cjs.map +1 -1
- package/dist/components/GnomeProvider/GnomeProvider.d.ts +1 -1
- package/dist/components/GnomeProvider/GnomeProvider.js +2 -2
- package/dist/components/GnomeProvider/GnomeProvider.js.map +1 -1
- package/dist/components/HeaderBar/HeaderBar.cjs +1 -1
- package/dist/components/HeaderBar/HeaderBar.cjs.map +1 -1
- package/dist/components/HeaderBar/HeaderBar.d.ts +1 -1
- package/dist/components/HeaderBar/HeaderBar.js +26 -28
- package/dist/components/HeaderBar/HeaderBar.js.map +1 -1
- package/dist/components/HeaderBar.cjs +1 -1
- package/dist/components/Icon/Icon.cjs +1 -1
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Icon.cjs +1 -1
- package/dist/components/IconButton/IconButton.cjs +1 -1
- package/dist/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.js +4 -4
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/IconButton.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.cjs.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.d.ts +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.js +2 -2
- package/dist/components/InlineViewSwitcher/InlineViewSwitcher.js.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.cjs +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.cjs.map +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.d.ts +1 -1
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.js +2 -2
- package/dist/components/InlineViewSwitcher/InlineViewSwitcherItem.js.map +1 -1
- package/dist/components/InlineViewSwitcher.cjs +1 -1
- package/dist/components/Link/Link.cjs +1 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +2 -2
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/Link.cjs +1 -1
- package/dist/components/LinkedGroup/LinkedGroup.cjs +1 -1
- package/dist/components/LinkedGroup/LinkedGroup.cjs.map +1 -1
- package/dist/components/LinkedGroup/LinkedGroup.d.ts +1 -1
- package/dist/components/LinkedGroup/LinkedGroup.js +9 -11
- package/dist/components/LinkedGroup/LinkedGroup.js.map +1 -1
- package/dist/components/LinkedGroup.cjs +1 -1
- package/dist/components/NavigationSplitView/NavigationSplitView.cjs +1 -1
- package/dist/components/NavigationSplitView/NavigationSplitView.cjs.map +1 -1
- package/dist/components/NavigationSplitView/NavigationSplitView.d.ts +1 -1
- package/dist/components/NavigationSplitView/NavigationSplitView.js +2 -2
- package/dist/components/NavigationSplitView/NavigationSplitView.js.map +1 -1
- package/dist/components/NavigationSplitView.cjs +1 -1
- package/dist/components/NavigationView/NavigationView.cjs +1 -1
- package/dist/components/NavigationView/NavigationView.cjs.map +1 -1
- package/dist/components/NavigationView/NavigationView.d.ts +2 -2
- package/dist/components/NavigationView/NavigationView.js +3 -4
- package/dist/components/NavigationView/NavigationView.js.map +1 -1
- package/dist/components/NavigationView/NavigationView.module.css.cjs +1 -1
- package/dist/components/NavigationView/NavigationView.module.css.js +9 -10
- package/dist/components/NavigationView.cjs +1 -1
- package/dist/components/OverlaySplitView/OverlaySplitView.cjs +1 -1
- package/dist/components/OverlaySplitView/OverlaySplitView.cjs.map +1 -1
- package/dist/components/OverlaySplitView/OverlaySplitView.d.ts +1 -1
- package/dist/components/OverlaySplitView/OverlaySplitView.js +2 -2
- package/dist/components/OverlaySplitView/OverlaySplitView.js.map +1 -1
- package/dist/components/OverlaySplitView.cjs +1 -1
- package/dist/components/PasswordEntryRow/PasswordEntryRow.cjs +1 -1
- package/dist/components/PasswordEntryRow/PasswordEntryRow.cjs.map +1 -1
- package/dist/components/PasswordEntryRow/PasswordEntryRow.d.ts +1 -1
- package/dist/components/PasswordEntryRow/PasswordEntryRow.js +11 -10
- package/dist/components/PasswordEntryRow/PasswordEntryRow.js.map +1 -1
- package/dist/components/PasswordEntryRow.cjs +1 -1
- package/dist/components/PathBar/PathBar.cjs +1 -1
- package/dist/components/PathBar/PathBar.cjs.map +1 -1
- package/dist/components/PathBar/PathBar.d.ts +1 -1
- package/dist/components/PathBar/PathBar.js +48 -50
- package/dist/components/PathBar/PathBar.js.map +1 -1
- package/dist/components/PathBar.cjs +1 -1
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +5 -5
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover.cjs +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.cjs +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.cjs.map +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.d.ts +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.js +2 -2
- package/dist/components/PreferencesDialog/PreferencesDialog.js.map +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.module.css.cjs +1 -1
- package/dist/components/PreferencesDialog/PreferencesDialog.module.css.js +18 -19
- package/dist/components/PreferencesDialog.cjs +1 -1
- package/dist/components/PreferencesGroup/PreferencesGroup.cjs +1 -1
- package/dist/components/PreferencesGroup/PreferencesGroup.cjs.map +1 -1
- package/dist/components/PreferencesGroup/PreferencesGroup.d.ts +1 -1
- package/dist/components/PreferencesGroup/PreferencesGroup.js +2 -2
- package/dist/components/PreferencesGroup/PreferencesGroup.js.map +1 -1
- package/dist/components/PreferencesGroup.cjs +1 -1
- package/dist/components/PreferencesPage/PreferencesPage.cjs +1 -1
- package/dist/components/PreferencesPage/PreferencesPage.cjs.map +1 -1
- package/dist/components/PreferencesPage/PreferencesPage.d.ts +1 -1
- package/dist/components/PreferencesPage/PreferencesPage.js +9 -11
- package/dist/components/PreferencesPage/PreferencesPage.js.map +1 -1
- package/dist/components/PreferencesPage.cjs +1 -1
- package/dist/components/ProgressBar/ProgressBar.cjs +1 -1
- package/dist/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +2 -2
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressBar.cjs +1 -1
- package/dist/components/RadioButton/RadioButton.cjs +1 -1
- package/dist/components/RadioButton/RadioButton.cjs.map +1 -1
- package/dist/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.js +5 -7
- package/dist/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/RadioButton.cjs +1 -1
- package/dist/components/SearchBar/SearchBar.cjs +1 -1
- package/dist/components/SearchBar/SearchBar.cjs.map +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +2 -2
- package/dist/components/SearchBar/SearchBar.js.map +1 -1
- package/dist/components/SearchBar.cjs +1 -1
- package/dist/components/SegmentedBar/SegmentedBar.cjs +1 -1
- package/dist/components/SegmentedBar/SegmentedBar.cjs.map +1 -1
- package/dist/components/SegmentedBar/SegmentedBar.js.map +1 -1
- package/dist/components/SegmentedBar.cjs +1 -1
- package/dist/components/Separator/Separator.cjs +1 -1
- package/dist/components/Separator/Separator.cjs.map +1 -1
- package/dist/components/Separator/Separator.d.ts +1 -1
- package/dist/components/Separator/Separator.js +2 -2
- package/dist/components/Separator/Separator.js.map +1 -1
- package/dist/components/Separator.cjs +1 -1
- package/dist/components/ShortcutLabel/ShortcutLabel.cjs +1 -1
- package/dist/components/ShortcutLabel/ShortcutLabel.cjs.map +1 -1
- package/dist/components/ShortcutLabel/ShortcutLabel.d.ts +1 -1
- package/dist/components/ShortcutLabel/ShortcutLabel.js +2 -3
- package/dist/components/ShortcutLabel/ShortcutLabel.js.map +1 -1
- package/dist/components/ShortcutLabel.cjs +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.cjs +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.cjs.map +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.d.ts +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.js +75 -76
- package/dist/components/ShortcutsDialog/ShortcutsDialog.js.map +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.module.css.cjs +1 -1
- package/dist/components/ShortcutsDialog/ShortcutsDialog.module.css.js +21 -22
- package/dist/components/ShortcutsDialog.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.cjs.map +1 -1
- package/dist/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.js +2 -3
- package/dist/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/components/Sidebar/Sidebar.module.css.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.module.css.js +33 -34
- package/dist/components/Sidebar/SidebarItem.cjs +1 -1
- package/dist/components/Sidebar/SidebarItem.cjs.map +1 -1
- package/dist/components/Sidebar/SidebarItem.d.ts +1 -1
- package/dist/components/Sidebar/SidebarItem.js +16 -16
- package/dist/components/Sidebar/SidebarItem.js.map +1 -1
- package/dist/components/Sidebar/SidebarSection.cjs +1 -1
- package/dist/components/Sidebar/SidebarSection.cjs.map +1 -1
- package/dist/components/Sidebar/SidebarSection.js.map +1 -1
- package/dist/components/Sidebar.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.js +9 -10
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Skeleton.cjs +1 -1
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.cjs.map +1 -1
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Slider/Slider.js +2 -2
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Slider.cjs +1 -1
- package/dist/components/SpinButton/SpinButton.cjs +1 -1
- package/dist/components/SpinButton/SpinButton.cjs.map +1 -1
- package/dist/components/SpinButton/SpinButton.d.ts +1 -1
- package/dist/components/SpinButton/SpinButton.js +2 -2
- package/dist/components/SpinButton/SpinButton.js.map +1 -1
- package/dist/components/SpinButton.cjs +1 -1
- package/dist/components/SpinRow/SpinRow.cjs +1 -1
- package/dist/components/SpinRow/SpinRow.cjs.map +1 -1
- package/dist/components/SpinRow/SpinRow.d.ts +1 -1
- package/dist/components/SpinRow/SpinRow.js +2 -2
- package/dist/components/SpinRow/SpinRow.js.map +1 -1
- package/dist/components/SpinRow.cjs +1 -1
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.d.ts +1 -1
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/Spinner.cjs +1 -1
- package/dist/components/SplitButton/SplitButton.cjs +1 -1
- package/dist/components/SplitButton/SplitButton.cjs.map +1 -1
- package/dist/components/SplitButton/SplitButton.d.ts +1 -1
- package/dist/components/SplitButton/SplitButton.js +2 -2
- package/dist/components/SplitButton/SplitButton.js.map +1 -1
- package/dist/components/SplitButton.cjs +1 -1
- package/dist/components/StatusBadge/StatusBadge.cjs +1 -1
- package/dist/components/StatusBadge/StatusBadge.cjs.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.d.ts +1 -1
- package/dist/components/StatusBadge/StatusBadge.js +9 -11
- package/dist/components/StatusBadge/StatusBadge.js.map +1 -1
- package/dist/components/StatusBadge.cjs +1 -1
- package/dist/components/StatusPage/StatusPage.cjs +1 -1
- package/dist/components/StatusPage/StatusPage.cjs.map +1 -1
- package/dist/components/StatusPage/StatusPage.d.ts +1 -1
- package/dist/components/StatusPage/StatusPage.js +2 -2
- package/dist/components/StatusPage/StatusPage.js.map +1 -1
- package/dist/components/StatusPage.cjs +1 -1
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Switch/Switch.js +6 -8
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Switch.cjs +1 -1
- package/dist/components/SwitchRow/SwitchRow.cjs +1 -1
- package/dist/components/SwitchRow/SwitchRow.cjs.map +1 -1
- package/dist/components/SwitchRow/SwitchRow.d.ts +1 -1
- package/dist/components/SwitchRow/SwitchRow.js +7 -7
- package/dist/components/SwitchRow/SwitchRow.js.map +1 -1
- package/dist/components/SwitchRow.cjs +1 -1
- package/dist/components/Tabs/TabBar.cjs +1 -1
- package/dist/components/Tabs/TabBar.cjs.map +1 -1
- package/dist/components/Tabs/TabBar.d.ts +1 -1
- package/dist/components/Tabs/TabBar.js +2 -2
- package/dist/components/Tabs/TabBar.js.map +1 -1
- package/dist/components/Tabs/TabItem.cjs +1 -1
- package/dist/components/Tabs/TabItem.cjs.map +1 -1
- package/dist/components/Tabs/TabItem.js.map +1 -1
- package/dist/components/Tabs/TabPanel.cjs +1 -1
- package/dist/components/Tabs/TabPanel.cjs.map +1 -1
- package/dist/components/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/Tabs/TabPanel.js +8 -10
- package/dist/components/Tabs/TabPanel.js.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/TerminalView/TerminalView.cjs +1 -1
- package/dist/components/TerminalView/TerminalView.cjs.map +1 -1
- package/dist/components/TerminalView/TerminalView.d.ts +1 -1
- package/dist/components/TerminalView/TerminalView.js +2 -2
- package/dist/components/TerminalView/TerminalView.js.map +1 -1
- package/dist/components/TerminalView.cjs +1 -1
- package/dist/components/Text/Text.cjs +1 -1
- package/dist/components/Text/Text.cjs.map +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/Text/Text.js +10 -13
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/Text/Text.module.css.cjs +1 -1
- package/dist/components/Text/Text.module.css.js +9 -10
- package/dist/components/Text.cjs +1 -1
- package/dist/components/TextField/TextField.cjs +1 -1
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TextField/TextField.js +2 -2
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField.cjs +1 -1
- package/dist/components/Timeline/Timeline.cjs +1 -1
- package/dist/components/Timeline/Timeline.cjs.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts +1 -1
- package/dist/components/Timeline/Timeline.js +2 -2
- package/dist/components/Timeline/Timeline.js.map +1 -1
- package/dist/components/Timeline.cjs +1 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.cjs.map +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/Toast/Toast.js +2 -2
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Toast/Toast.module.css.cjs +1 -1
- package/dist/components/Toast/Toast.module.css.js +10 -11
- package/dist/components/Toast/Toaster.cjs +1 -1
- package/dist/components/Toast/Toaster.cjs.map +1 -1
- package/dist/components/Toast/Toaster.d.ts +1 -1
- package/dist/components/Toast/Toaster.js +2 -2
- package/dist/components/Toast/Toaster.js.map +1 -1
- package/dist/components/Toast.cjs +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.cjs.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.cjs.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroupItem.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroupItem.js.map +1 -1
- package/dist/components/ToggleGroup.cjs +1 -1
- package/dist/components/Toolbar/Spacer.cjs +1 -1
- package/dist/components/Toolbar/Spacer.cjs.map +1 -1
- package/dist/components/Toolbar/Spacer.d.ts +1 -1
- package/dist/components/Toolbar/Spacer.js +5 -7
- package/dist/components/Toolbar/Spacer.js.map +1 -1
- package/dist/components/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/Toolbar/Toolbar.cjs.map +1 -1
- package/dist/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/components/Toolbar/Toolbar.js +5 -7
- package/dist/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/Toolbar.cjs +1 -1
- package/dist/components/ToolbarView/ToolbarView.cjs +1 -1
- package/dist/components/ToolbarView/ToolbarView.cjs.map +1 -1
- package/dist/components/ToolbarView/ToolbarView.d.ts +1 -1
- package/dist/components/ToolbarView/ToolbarView.js +18 -20
- package/dist/components/ToolbarView/ToolbarView.js.map +1 -1
- package/dist/components/ToolbarView.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip.cjs +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcher.cjs +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcher.cjs.map +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcher.d.ts +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcher.js +2 -2
- package/dist/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcherItem.cjs +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcherItem.cjs.map +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcherItem.d.ts +1 -1
- package/dist/components/ViewSwitcher/ViewSwitcherItem.js +24 -26
- package/dist/components/ViewSwitcher/ViewSwitcherItem.js.map +1 -1
- package/dist/components/ViewSwitcher.cjs +1 -1
- package/dist/components/ViewSwitcherBar/ViewSwitcherBar.cjs +1 -1
- package/dist/components/ViewSwitcherBar/ViewSwitcherBar.cjs.map +1 -1
- package/dist/components/ViewSwitcherBar/ViewSwitcherBar.d.ts +1 -1
- package/dist/components/ViewSwitcherBar/ViewSwitcherBar.js +7 -9
- package/dist/components/ViewSwitcherBar/ViewSwitcherBar.js.map +1 -1
- package/dist/components/ViewSwitcherBar.cjs +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebar.cjs +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebar.cjs.map +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebar.d.ts +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebar.js +2 -2
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebar.js.map +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebarItem.cjs +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebarItem.cjs.map +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebarItem.d.ts +1 -1
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebarItem.js +2 -2
- package/dist/components/ViewSwitcherSidebar/ViewSwitcherSidebarItem.js.map +1 -1
- package/dist/components/ViewSwitcherSidebar.cjs +1 -1
- package/dist/components/WindowTitle/WindowTitle.cjs +1 -1
- package/dist/components/WindowTitle/WindowTitle.cjs.map +1 -1
- package/dist/components/WindowTitle/WindowTitle.d.ts +1 -1
- package/dist/components/WindowTitle/WindowTitle.js +11 -13
- package/dist/components/WindowTitle/WindowTitle.js.map +1 -1
- package/dist/components/WindowTitle.cjs +1 -1
- package/dist/components/WrapBox/WrapBox.cjs +1 -1
- package/dist/components/WrapBox/WrapBox.cjs.map +1 -1
- package/dist/components/WrapBox/WrapBox.d.ts +1 -1
- package/dist/components/WrapBox/WrapBox.js +5 -5
- package/dist/components/WrapBox/WrapBox.js.map +1 -1
- package/dist/components/WrapBox.cjs +1 -1
- package/dist/hooks/useBreakpoint.cjs +1 -1
- package/dist/hooks/useBreakpoint.cjs.map +1 -1
- package/dist/hooks/useBreakpoint.js.map +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import {\n cloneElement,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport styles from './Popover.module.css';\n\nexport type PopoverPlacement = 'top' | 'bottom' | 'left' | 'right';\n\nexport interface PopoverProps {\n /**\n * The rich content rendered inside the popover panel.\n * Can include interactive elements (buttons, links, forms).\n */\n content: ReactNode;\n /**\n * Preferred placement relative to the trigger.\n * Flips automatically when there is not enough viewport space.\n * Defaults to `\"bottom\"`.\n */\n placement?: PopoverPlacement;\n /**\n * Whether the popover is open (controlled mode).\n * Omit to use uncontrolled mode where the trigger toggles it.\n */\n open?: boolean;\n /**\n * Called when the popover requests to be closed\n * (Escape key, outside click, or trigger click while open).\n */\n onClose?: () => void;\n /**\n * Called when open state should change (controlled mode).\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger element. Must be a single React element that can\n * receive `ref` and click/keyboard event props.\n */\n children: ReactElement<HTMLAttributes<HTMLElement>>;\n}\n\ninterface Position {\n top: number;\n left: number;\n placement: PopoverPlacement;\n /** Arrow center offset in px from the near edge of the panel.\n * Horizontal (left) for top/bottom; vertical (top) for left/right.\n * Undefined means use the default 50% CSS. */\n arrowOffset?: number;\n}\n\nconst GAP = 8;\nconst MARGIN = 10;\nconst ARROW_HALF = 6; // half of the 12 px arrow\n\nfunction computePosition(\n trigger: DOMRect,\n popover: DOMRect,\n preferred: PopoverPlacement,\n): Position {\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n const order: PopoverPlacement[] = [\n preferred,\n preferred === 'top'\n ? 'bottom'\n : preferred === 'bottom'\n ? 'top'\n : preferred === 'left'\n ? 'right'\n : 'left',\n 'bottom',\n 'top',\n 'left',\n 'right',\n ];\n\n // De-duplicate while preserving order\n const candidates = [...new Set(order)];\n\n function calcRaw(p: PopoverPlacement): { top: number; left: number } {\n if (p === 'bottom') {\n return {\n top: trigger.bottom + GAP,\n left: trigger.left + trigger.width / 2 - popover.width / 2,\n };\n }\n\n if (p === 'top') {\n return {\n top: trigger.top - popover.height - GAP,\n left: trigger.left + trigger.width / 2 - popover.width / 2,\n };\n }\n\n if (p === 'left') {\n return {\n top: trigger.top + trigger.height / 2 - popover.height / 2,\n left: trigger.left - popover.width - GAP,\n };\n }\n\n return {\n top: trigger.top + trigger.height / 2 - popover.height / 2,\n left: trigger.right + GAP,\n };\n }\n\n // First pass: find a placement that fits both axes perfectly.\n for (const p of candidates) {\n const { top, left } = calcRaw(p);\n const fitsH = left >= MARGIN && left + popover.width <= vw - MARGIN;\n const fitsV = top >= MARGIN && top + popover.height <= vh - MARGIN;\n\n if (fitsH && fitsV) {\n // Always use pixel arrowOffset (never rely on CSS left:50%) so the arrow\n // points exactly at the trigger center regardless of sub-pixel rounding.\n const arrowOffset =\n p === 'top' || p === 'bottom'\n ? trigger.left + trigger.width / 2 - left\n : trigger.top + trigger.height / 2 - top;\n\n return { top, left, placement: p, arrowOffset };\n }\n }\n\n // Second pass: fits the primary axis; clamp the secondary axis and\n // shift the arrow so it still points at the trigger center.\n for (const p of candidates) {\n const { top, left } = calcRaw(p);\n const fitsV = top >= MARGIN && top + popover.height <= vh - MARGIN;\n const fitsH = left >= MARGIN && left + popover.width <= vw - MARGIN;\n\n if ((p === 'top' || p === 'bottom') && fitsV) {\n const clampedLeft = Math.max(MARGIN, Math.min(left, vw - popover.width - MARGIN));\n const rawOffset = trigger.left + trigger.width / 2 - clampedLeft;\n\n return {\n top,\n left: clampedLeft,\n placement: p,\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawOffset, popover.width - ARROW_HALF - 4)),\n };\n }\n\n if ((p === 'left' || p === 'right') && fitsH) {\n const clampedTop = Math.max(MARGIN, Math.min(top, vh - popover.height - MARGIN));\n const rawOffset = trigger.top + trigger.height / 2 - clampedTop;\n\n return {\n top: clampedTop,\n left,\n placement: p,\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawOffset, popover.height - ARROW_HALF - 4)),\n };\n }\n }\n\n // Fallback: clamp bottom placement and shift arrow to match trigger.\n const fbTop = trigger.bottom + GAP;\n const fbLeft = trigger.left + trigger.width / 2 - popover.width / 2;\n const clampedTop = Math.max(MARGIN, Math.min(fbTop, vh - popover.height - MARGIN));\n const clampedLeft = Math.max(MARGIN, Math.min(fbLeft, vw - popover.width - MARGIN));\n const rawArrowOffset = trigger.left + trigger.width / 2 - clampedLeft;\n\n return {\n top: clampedTop,\n left: clampedLeft,\n placement: 'bottom',\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawArrowOffset, popover.width - ARROW_HALF - 4)),\n };\n}\n\n/**\n * Floating panel anchored to a trigger element.\n *\n * Unlike `Tooltip`, a Popover can contain rich interactive content\n * (menus, forms, details). It follows the Adwaita `GtkPopover` pattern.\n *\n * - Supports both controlled (`open` + `onClose`) and uncontrolled modes.\n * - Auto-positions with viewport-aware flip.\n * - Closes on Escape, outside click, or trigger re-click.\n * - Focus is moved into the panel on open; returns to the trigger on close.\n * - `aria-haspopup=\"dialog\"` + `aria-expanded` wired to the trigger.\n * - `role=\"dialog\"` on the panel with `aria-labelledby` when a heading is present.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Popover.html\n */\nexport function Popover({\n content,\n placement: preferredPlacement = 'bottom',\n open: controlledOpen,\n onClose,\n onOpenChange,\n children,\n}: PopoverProps) {\n const isControlled = controlledOpen !== undefined;\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n const [pos, setPos] = useState<Position | null>(null);\n\n const triggerId = useId();\n const popoverId = useId();\n const triggerRef = useRef<HTMLElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const previouslyFocused = useRef<Element | null>(null);\n\n const close = useCallback(() => {\n if (isControlled) {\n onClose?.();\n } else {\n setUncontrolledOpen(false);\n }\n\n onOpenChange?.(false);\n }, [isControlled, onClose, onOpenChange]);\n\n const toggle = useCallback(() => {\n if (open) {\n close();\n } else {\n if (!isControlled) {\n setUncontrolledOpen(true);\n }\n\n onOpenChange?.(true);\n }\n }, [open, close, isControlled, onOpenChange]);\n\n // Position panel\n const place = useCallback(() => {\n if (!triggerRef.current || !panelRef.current) {\n return;\n }\n\n setPos(\n computePosition(\n triggerRef.current.getBoundingClientRect(),\n panelRef.current.getBoundingClientRect(),\n preferredPlacement,\n ),\n );\n }, [preferredPlacement]);\n\n // Reposition on open, scroll, resize\n useEffect(() => {\n if (!open) {\n return;\n }\n\n // Two RAF: first lets panel mount with hidden styles so we can measure it;\n // second applies the measured position.\n const id = requestAnimationFrame(() => {\n place();\n window.addEventListener('scroll', place, { passive: true, capture: true });\n window.addEventListener('resize', place, { passive: true });\n });\n\n return () => {\n cancelAnimationFrame(id);\n window.removeEventListener('scroll', place, { capture: true });\n window.removeEventListener('resize', place);\n };\n }, [open, place]);\n\n // Save / restore focus\n useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement;\n requestAnimationFrame(() => {\n const first = panelRef.current?.querySelector<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n (first ?? panelRef.current)?.focus();\n });\n } else {\n (previouslyFocused.current as HTMLElement | null)?.focus();\n setPos(null);\n }\n }, [open]);\n\n // Close on outside pointer\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const handler = (e: MouseEvent) => {\n if (\n !triggerRef.current?.contains(e.target as Node) &&\n !panelRef.current?.contains(e.target as Node)\n ) {\n close();\n }\n };\n\n document.addEventListener('mousedown', handler);\n\n return () => document.removeEventListener('mousedown', handler);\n }, [open, close]);\n\n // Escape key\n const handlePanelKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n close();\n }\n },\n [close],\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const trigger = cloneElement(children as any, {\n ref: triggerRef,\n id: triggerId,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': open,\n 'aria-controls': open ? popoverId : undefined,\n onClick: (e: ReactMouseEvent<HTMLElement>) => {\n toggle();\n children.props.onClick?.(e);\n },\n });\n\n const panel = (\n <div\n ref={panelRef}\n id={popoverId}\n role=\"dialog\"\n aria-labelledby={triggerId}\n tabIndex={-1}\n className={[\n styles.panel,\n pos ? styles[pos.placement] : null,\n open && pos ? styles.visible : null,\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n pos\n ? { top: pos.top, left: pos.left }\n : { visibility: 'hidden', pointerEvents: 'none', top: -9999, left: -9999 }\n }\n onKeyDown={handlePanelKeyDown}\n >\n {/* Arrow — offset shifts it to point at the trigger when the panel is clamped */}\n <div\n className={styles.arrow}\n aria-hidden=\"true\"\n style={\n pos?.arrowOffset !== undefined\n ? pos.placement === 'top' || pos.placement === 'bottom'\n ? { left: pos.arrowOffset - ARROW_HALF, marginLeft: 0 }\n : { top: pos.arrowOffset - ARROW_HALF, marginTop: 0 }\n : undefined\n }\n />\n {content}\n </div>\n );\n\n return (\n <>\n {trigger}\n {open && (typeof document !== 'undefined' ? createPortal(panel, document.body) : panel)}\n </>\n );\n}\n"],"mappings":";;;;;AA+DA,IAAM,IAAM,GACN,IAAS,IACT,IAAa;AAEnB,SAAS,EACP,GACA,GACA,GACU;CACV,IAAM,IAAK,OAAO,YACZ,IAAK,OAAO,aAkBZ,IAAa,CAAC,GAAG,IAAI,IAhBO;EAChC;EACA,MAAc,QACV,WACA,MAAc,WACZ,QACA,MAAc,SACZ,UACA;EACR;EACA;EACA;EACA;EACD,CAGoC,CAAC;CAEtC,SAAS,EAAQ,GAAoD;AAsBnE,SArBI,MAAM,WACD;GACL,KAAK,EAAQ,SAAS;GACtB,MAAM,EAAQ,OAAO,EAAQ,QAAQ,IAAI,EAAQ,QAAQ;GAC1D,GAGC,MAAM,QACD;GACL,KAAK,EAAQ,MAAM,EAAQ,SAAS;GACpC,MAAM,EAAQ,OAAO,EAAQ,QAAQ,IAAI,EAAQ,QAAQ;GAC1D,GAGC,MAAM,SACD;GACL,KAAK,EAAQ,MAAM,EAAQ,SAAS,IAAI,EAAQ,SAAS;GACzD,MAAM,EAAQ,OAAO,EAAQ,QAAQ;GACtC,GAGI;GACL,KAAK,EAAQ,MAAM,EAAQ,SAAS,IAAI,EAAQ,SAAS;GACzD,MAAM,EAAQ,QAAQ;GACvB;;AAIH,MAAK,IAAM,KAAK,GAAY;EAC1B,IAAM,EAAE,QAAK,YAAS,EAAQ,EAAE,EAC1B,IAAQ,KAAQ,KAAU,IAAO,EAAQ,SAAS,IAAK,GACvD,IAAQ,KAAO,KAAU,IAAM,EAAQ,UAAU,IAAK;AAE5D,MAAI,KAAS,EAQX,QAAO;GAAE;GAAK;GAAM,WAAW;GAAG,aAJhC,MAA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I,cAAc,SAAS,EAAI,cAAc,WAC3C;IAAE,MAAM,EAAI,cAAc;IAAY,YAAY;IAAG,GACrD;IAAE,KAAK,EAAI,cAAc;IAAY,WAAW;IAAG;GAG3D,CAAA,EACD,EACG;;AAGR,QACE,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,MAAS,OAAO,WAAa,MAAc,EAAa,GAAO,SAAS,KAAK,GAAG,GAChF,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"Popover.js","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import {\n cloneElement,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactElement,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport styles from './Popover.module.css';\n\nexport type PopoverPlacement = 'top' | 'bottom' | 'left' | 'right';\n\nexport interface PopoverProps {\n /**\n * The rich content rendered inside the popover panel.\n * Can include interactive elements (buttons, links, forms).\n */\n content: ReactNode;\n /**\n * Preferred placement relative to the trigger.\n * Flips automatically when there is not enough viewport space.\n * Defaults to `\"bottom\"`.\n */\n placement?: PopoverPlacement;\n /**\n * Whether the popover is open (controlled mode).\n * Omit to use uncontrolled mode where the trigger toggles it.\n */\n open?: boolean;\n /**\n * Called when the popover requests to be closed\n * (Escape key, outside click, or trigger click while open).\n */\n onClose?: () => void;\n /**\n * Called when open state should change (controlled mode).\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The trigger element. Must be a single React element that can\n * receive `ref` and click/keyboard event props.\n */\n children: ReactElement<HTMLAttributes<HTMLElement>>;\n}\n\ninterface Position {\n top: number;\n left: number;\n placement: PopoverPlacement;\n /** Arrow center offset in px from the near edge of the panel.\n * Horizontal (left) for top/bottom; vertical (top) for left/right.\n * Undefined means use the default 50% CSS. */\n arrowOffset?: number;\n}\n\nconst GAP = 8;\nconst MARGIN = 10;\nconst ARROW_HALF = 6; // half of the 12 px arrow\n\nfunction computePosition(\n trigger: DOMRect,\n popover: DOMRect,\n preferred: PopoverPlacement,\n): Position {\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n\n const order: PopoverPlacement[] = [\n preferred,\n preferred === 'top'\n ? 'bottom'\n : preferred === 'bottom'\n ? 'top'\n : preferred === 'left'\n ? 'right'\n : 'left',\n 'bottom',\n 'top',\n 'left',\n 'right',\n ];\n\n // De-duplicate while preserving order\n const candidates = [...new Set(order)];\n\n function calcRaw(p: PopoverPlacement): { top: number; left: number } {\n if (p === 'bottom') {\n return {\n top: trigger.bottom + GAP,\n left: trigger.left + trigger.width / 2 - popover.width / 2,\n };\n }\n\n if (p === 'top') {\n return {\n top: trigger.top - popover.height - GAP,\n left: trigger.left + trigger.width / 2 - popover.width / 2,\n };\n }\n\n if (p === 'left') {\n return {\n top: trigger.top + trigger.height / 2 - popover.height / 2,\n left: trigger.left - popover.width - GAP,\n };\n }\n\n return {\n top: trigger.top + trigger.height / 2 - popover.height / 2,\n left: trigger.right + GAP,\n };\n }\n\n // First pass: find a placement that fits both axes perfectly.\n for (const p of candidates) {\n const { top, left } = calcRaw(p);\n const fitsH = left >= MARGIN && left + popover.width <= vw - MARGIN;\n const fitsV = top >= MARGIN && top + popover.height <= vh - MARGIN;\n\n if (fitsH && fitsV) {\n // Always use pixel arrowOffset (never rely on CSS left:50%) so the arrow\n // points exactly at the trigger center regardless of sub-pixel rounding.\n const arrowOffset =\n p === 'top' || p === 'bottom'\n ? trigger.left + trigger.width / 2 - left\n : trigger.top + trigger.height / 2 - top;\n\n return { top, left, placement: p, arrowOffset };\n }\n }\n\n // Second pass: fits the primary axis; clamp the secondary axis and\n // shift the arrow so it still points at the trigger center.\n for (const p of candidates) {\n const { top, left } = calcRaw(p);\n const fitsV = top >= MARGIN && top + popover.height <= vh - MARGIN;\n const fitsH = left >= MARGIN && left + popover.width <= vw - MARGIN;\n\n if ((p === 'top' || p === 'bottom') && fitsV) {\n const clampedLeft = Math.max(MARGIN, Math.min(left, vw - popover.width - MARGIN));\n const rawOffset = trigger.left + trigger.width / 2 - clampedLeft;\n\n return {\n top,\n left: clampedLeft,\n placement: p,\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawOffset, popover.width - ARROW_HALF - 4)),\n };\n }\n\n if ((p === 'left' || p === 'right') && fitsH) {\n const clampedTop = Math.max(MARGIN, Math.min(top, vh - popover.height - MARGIN));\n const rawOffset = trigger.top + trigger.height / 2 - clampedTop;\n\n return {\n top: clampedTop,\n left,\n placement: p,\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawOffset, popover.height - ARROW_HALF - 4)),\n };\n }\n }\n\n // Fallback: clamp bottom placement and shift arrow to match trigger.\n const fbTop = trigger.bottom + GAP;\n const fbLeft = trigger.left + trigger.width / 2 - popover.width / 2;\n const clampedTop = Math.max(MARGIN, Math.min(fbTop, vh - popover.height - MARGIN));\n const clampedLeft = Math.max(MARGIN, Math.min(fbLeft, vw - popover.width - MARGIN));\n const rawArrowOffset = trigger.left + trigger.width / 2 - clampedLeft;\n\n return {\n top: clampedTop,\n left: clampedLeft,\n placement: 'bottom',\n arrowOffset: Math.max(ARROW_HALF + 4, Math.min(rawArrowOffset, popover.width - ARROW_HALF - 4)),\n };\n}\n\n/**\n * Floating panel anchored to a trigger element.\n *\n * Unlike `Tooltip`, a Popover can contain rich interactive content\n * (menus, forms, details). It follows the Adwaita `GtkPopover` pattern.\n *\n * - Supports both controlled (`open` + `onClose`) and uncontrolled modes.\n * - Auto-positions with viewport-aware flip.\n * - Closes on Escape, outside click, or trigger re-click.\n * - Focus is moved into the panel on open; returns to the trigger on close.\n * - `aria-haspopup=\"dialog\"` + `aria-expanded` wired to the trigger.\n * - `role=\"dialog\"` on the panel with `aria-labelledby` when a heading is present.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Popover.html\n */\nexport const Popover = ({\n content,\n placement: preferredPlacement = 'bottom',\n open: controlledOpen,\n onClose,\n onOpenChange,\n children,\n}: PopoverProps) => {\n const isControlled = controlledOpen !== undefined;\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n const [pos, setPos] = useState<Position | null>(null);\n\n const triggerId = useId();\n const popoverId = useId();\n const triggerRef = useRef<HTMLElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const previouslyFocused = useRef<Element | null>(null);\n\n const close = useCallback(() => {\n if (isControlled) {\n onClose?.();\n } else {\n setUncontrolledOpen(false);\n }\n\n onOpenChange?.(false);\n }, [isControlled, onClose, onOpenChange]);\n\n const toggle = useCallback(() => {\n if (open) {\n close();\n } else {\n if (!isControlled) {\n setUncontrolledOpen(true);\n }\n\n onOpenChange?.(true);\n }\n }, [open, close, isControlled, onOpenChange]);\n\n // Position panel\n const place = useCallback(() => {\n if (!triggerRef.current || !panelRef.current) {\n return;\n }\n\n setPos(\n computePosition(\n triggerRef.current.getBoundingClientRect(),\n panelRef.current.getBoundingClientRect(),\n preferredPlacement,\n ),\n );\n }, [preferredPlacement]);\n\n // Reposition on open, scroll, resize\n useEffect(() => {\n if (!open) {\n return;\n }\n\n // Two RAF: first lets panel mount with hidden styles so we can measure it;\n // second applies the measured position.\n const id = requestAnimationFrame(() => {\n place();\n window.addEventListener('scroll', place, { passive: true, capture: true });\n window.addEventListener('resize', place, { passive: true });\n });\n\n return () => {\n cancelAnimationFrame(id);\n window.removeEventListener('scroll', place, { capture: true });\n window.removeEventListener('resize', place);\n };\n }, [open, place]);\n\n // Save / restore focus\n useEffect(() => {\n if (open) {\n previouslyFocused.current = document.activeElement;\n requestAnimationFrame(() => {\n const first = panelRef.current?.querySelector<HTMLElement>(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n (first ?? panelRef.current)?.focus();\n });\n } else {\n (previouslyFocused.current as HTMLElement | null)?.focus();\n setPos(null);\n }\n }, [open]);\n\n // Close on outside pointer\n useEffect(() => {\n if (!open) {\n return;\n }\n\n const handler = (e: MouseEvent) => {\n if (\n !triggerRef.current?.contains(e.target as Node) &&\n !panelRef.current?.contains(e.target as Node)\n ) {\n close();\n }\n };\n\n document.addEventListener('mousedown', handler);\n\n return () => document.removeEventListener('mousedown', handler);\n }, [open, close]);\n\n // Escape key\n const handlePanelKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n close();\n }\n },\n [close],\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const trigger = cloneElement(children as any, {\n ref: triggerRef,\n id: triggerId,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': open,\n 'aria-controls': open ? popoverId : undefined,\n onClick: (e: ReactMouseEvent<HTMLElement>) => {\n toggle();\n children.props.onClick?.(e);\n },\n });\n\n const panel = (\n <div\n ref={panelRef}\n id={popoverId}\n role=\"dialog\"\n aria-labelledby={triggerId}\n tabIndex={-1}\n className={[\n styles.panel,\n pos ? styles[pos.placement] : null,\n open && pos ? styles.visible : null,\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n pos\n ? { top: pos.top, left: pos.left }\n : { visibility: 'hidden', pointerEvents: 'none', top: -9999, left: -9999 }\n }\n onKeyDown={handlePanelKeyDown}\n >\n {/* Arrow — offset shifts it to point at the trigger when the panel is clamped */}\n <div\n className={styles.arrow}\n aria-hidden=\"true\"\n style={\n pos?.arrowOffset !== undefined\n ? pos.placement === 'top' || pos.placement === 'bottom'\n ? { left: pos.arrowOffset - ARROW_HALF, marginLeft: 0 }\n : { top: pos.arrowOffset - ARROW_HALF, marginTop: 0 }\n : undefined\n }\n />\n {content}\n </div>\n );\n\n return (\n <>\n {trigger}\n {open && (typeof document !== 'undefined' ? createPortal(panel, document.body) : panel)}\n </>\n );\n};\n"],"mappings":";;;;;AA+DA,IAAM,IAAM,GACN,IAAS,IACT,IAAa;AAEnB,SAAS,EACP,GACA,GACA,GACU;CACV,IAAM,IAAK,OAAO,YACZ,IAAK,OAAO,aAkBZ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object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./Popover/Popover.cjs");exports.Popover=e.Popover;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require("./PreferencesDialog.module.css.cjs");let t=require("react"),n=require("react-dom"),r=require("react/jsx-runtime");var i=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function a(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.current?.querySelectorAll(i)??[]);if(!n.length)return;let r=n[0],a=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),r.focus())}var o=({open:o,onClose:s,children:c,searchable:l=!0,className:u,...d})=>{let f=(0,t.useRef)(null),p=(0,t.useRef)(null),m=(0,t.useId)(),h=t.Children.toArray(c).filter(e=>(0,t.isValidElement)(e)),[g,_]=(0,t.useState)(0),[v,y]=(0,t.useState)(``);(0,t.useEffect)(()=>{if(o){_(0),y(``);let e=requestAnimationFrame(()=>{l&&p.current?p.current.focus():(f.current?.querySelector(i))?.focus()});return()=>cancelAnimationFrame(e)}},[o,l]);let b=(0,t.useCallback)(e=>{if(e.key===`Escape`){e.stopPropagation(),s();return}a(e,f)},[s]),x=h.length>1,S=h[g]??h[0],C=v.trim().toLowerCase();return o?(0,n.createPortal)((0,r.jsx)(`div`,{className:e.default.backdrop,onClick:e=>{e.target===e.currentTarget&&s()},role:`presentation`,children:(0,r.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-labelledby":m,className:[e.default.dialog,x?e.default.dialogMulti:null,u].filter(Boolean).join(` `),onKeyDown:b,...d,children:[(0,r.jsxs)(`div`,{className:e.default.header,children:[(0,r.jsx)(`button`,{type:`button`,className:e.default.closeBtn,onClick:s,"aria-label":`Close preferences`,children:`✕`}),(0,r.jsx)(`span`,{id:m,className:e.default.title,children:`Preferences`}),l&&(0,r.jsx)(`div`,{className:e.default.searchWrap,children:(0,r.jsx)(`input`,{ref:p,type:`search`,placeholder:`Search…`,value:v,onChange:e=>y(e.target.value),className:e.default.searchInput,"aria-label":`Search preferences`})})]}),(0,r.jsxs)(`div`,{className:e.default.body,children:[x&&(0,r.jsx)(`nav`,{className:e.default.sidebar,"aria-label":`Preferences pages`,children:(0,r.jsx)(`ul`,{className:e.default.navList,children:h.map((t,n)=>(0,r.jsx)(`li`,{role:`presentation`,children:(0,r.jsxs)(`button`,{role:`tab`,type:`button`,"aria-selected":n===g,className:[e.default.navItem,n===g?e.default.navItemActive:null].filter(Boolean).join(` `),onClick:()=>_(n),children:[t.props.iconName&&(0,r.jsx)(`span`,{className:[e.default.navIcon,`icon`,t.props.iconName].join(` `),"aria-hidden":`true`}),(0,r.jsx)(`span`,{className:e.default.navLabel,children:t.props.title})]})},n))})}),(0,r.jsx)(`div`,{className:e.default.pageWrap,children:S&&(0,t.cloneElement)(S,{"data-search-query":C||void 0})})]})]})}),document.body):null};exports.PreferencesDialog=o;
|
|
2
2
|
//# sourceMappingURL=PreferencesDialog.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesDialog.cjs","names":[],"sources":["../../../src/components/PreferencesDialog/PreferencesDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { PreferencesPageProps } from '../PreferencesPage/PreferencesPage';\n\nimport styles from './PreferencesDialog.module.css';\n\n// ─── Focus trap ───────────────────────────────────────────────────────────────\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction trapFocus(e: KeyboardEvent<HTMLDivElement>, ref: RefObject<HTMLDivElement | null>) {\n if (e.key !== 'Tab') {\n return;\n }\n\n const focusable = Array.from(ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? []);\n\n if (!focusable.length) {\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface PreferencesDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Whether the dialog is open. */\n open: boolean;\n /** Called when the user requests to close the dialog. */\n onClose: () => void;\n /**\n * `PreferencesPage` children. Each page appears as a sidebar entry.\n * When only one page is provided the sidebar is hidden.\n */\n children?: ReactNode;\n /**\n * Whether to show a search bar in the header.\n * When `true` the user can filter group/row content by typing.\n * Defaults to `true`.\n */\n searchable?: boolean;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * Multi-page settings dialog using `PreferencesPage` tabs.\n *\n * Renders a wide modal with an optional sidebar listing pages. Each\n * `PreferencesPage` child becomes a navigation entry. Supports built-in\n * search when `searchable` is `true` (the default).\n *\n * Mirrors `AdwPreferencesDialog`.\n *\n * @example\n * ```tsx\n * <PreferencesDialog open={open} onClose={() => setOpen(false)}>\n * <PreferencesPage title=\"General\" iconName=\"preferences-system-symbolic\">\n * <PreferencesGroup title=\"Appearance\">\n * <BoxedList>\n * <SwitchRow title=\"Dark mode\" />\n * </BoxedList>\n * </PreferencesGroup>\n * </PreferencesPage>\n * </PreferencesDialog>\n * ```\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesDialog.html\n */\nexport function PreferencesDialog({\n open,\n onClose,\n children,\n searchable = true,\n className,\n ...props\n}: PreferencesDialogProps) {\n const dialogRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const titleId = useId();\n\n const pages = Children.toArray(children).filter((c): c is ReactElement<PreferencesPageProps> =>\n isValidElement(c),\n ) as ReactElement<PreferencesPageProps>[];\n\n const [activeIndex, setActiveIndex] = useState(0);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveIndex(0);\n setSearchQuery('');\n // Focus search or first focusable after open animation\n const id = requestAnimationFrame(() => {\n if (searchable && searchRef.current) {\n searchRef.current.focus();\n } else {\n const first = dialogRef.current?.querySelector<HTMLElement>(FOCUSABLE);\n\n first?.focus();\n }\n });\n\n return () => cancelAnimationFrame(id);\n }\n }, [open, searchable]);\n\n // Close on Escape\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n onClose();\n\n return;\n }\n\n trapFocus(e, dialogRef);\n },\n [onClose],\n );\n\n const multiPage = pages.length > 1;\n const activePage = pages[activeIndex] ?? pages[0];\n\n // Filter content by search query\n const query = searchQuery.trim().toLowerCase();\n\n if (!open) {\n return null;\n }\n\n return createPortal(\n <div\n className={styles.backdrop}\n onClick={(e) => {\n if (e.target === e.currentTarget) {\n onClose();\n }\n }}\n role=\"presentation\"\n >\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={[styles.dialog, multiPage ? styles.dialogMulti : null, className]\n .filter(Boolean)\n .join(' ')}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <div className={styles.header}>\n <button\n type=\"button\"\n className={styles.closeBtn}\n onClick={onClose}\n aria-label=\"Close preferences\"\n >\n ✕\n </button>\n <span id={titleId} className={styles.title}>\n Preferences\n </span>\n {searchable && (\n <div className={styles.searchWrap}>\n <input\n ref={searchRef}\n type=\"search\"\n placeholder=\"Search…\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className={styles.searchInput}\n aria-label=\"Search preferences\"\n />\n </div>\n )}\n </div>\n\n {/* ── Body ───────────────────────────────────────────────────────── */}\n <div className={styles.body}>\n {/* Sidebar — only shown when there are multiple pages */}\n {multiPage && (\n <nav className={styles.sidebar} aria-label=\"Preferences pages\">\n <ul className={styles.navList}>\n {pages.map((page, i) => (\n <li key={i} role=\"presentation\">\n <button\n role=\"tab\"\n type=\"button\"\n aria-selected={i === activeIndex}\n className={[styles.navItem, i === activeIndex ? styles.navItemActive : null]\n .filter(Boolean)\n .join(' ')}\n onClick={() => setActiveIndex(i)}\n >\n {page.props.iconName && (\n <span\n className={[styles.navIcon, 'icon', page.props.iconName].join(' ')}\n aria-hidden=\"true\"\n />\n )}\n <span className={styles.navLabel}>{page.props.title}</span>\n </button>\n </li>\n ))}\n </ul>\n </nav>\n )}\n\n {/* Page content */}\n <div className={styles.pageWrap}>\n {activePage &&\n cloneElement(activePage, {\n 'data-search-query': query || undefined,\n } as Partial<PreferencesPageProps>)}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":"mIAwBA,IAAM,EACJ,2IAEF,SAAS,EAAU,EAAkC,EAAuC,CAC1F,GAAI,EAAE,MAAQ,MACZ,OAGF,IAAM,EAAY,MAAM,KAAK,EAAI,SAAS,iBAA8B,EAAU,EAAI,EAAE,CAAC,CAEzF,GAAI,CAAC,EAAU,OACb,OAGF,IAAM,EAAQ,EAAU,GAClB,EAAO,EAAU,EAAU,OAAS,GAEtC,EAAE,SACA,SAAS,gBAAkB,IAC7B,EAAE,gBAAgB,CAClB,EAAK,OAAO,EAGV,SAAS,gBAAkB,IAC7B,EAAE,gBAAgB,CAClB,EAAM,OAAO,EAmDnB,SAAgB,EAAkB,CAChC,OACA,UACA,WACA,aAAa,GACb,YACA,GAAG,GACsB,CACzB,IAAM,GAAA,EAAA,EAAA,QAAmC,KAAK,CACxC,GAAA,EAAA,EAAA,QAAqC,KAAK,CAC1C,GAAA,EAAA,EAAA,QAAiB,CA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GACF,CAAA,CACN,SAAS,KACV,CA9FQ"}
|
|
1
|
+
{"version":3,"file":"PreferencesDialog.cjs","names":[],"sources":["../../../src/components/PreferencesDialog/PreferencesDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { PreferencesPageProps } from '../PreferencesPage/PreferencesPage';\n\nimport styles from './PreferencesDialog.module.css';\n\n// ─── Focus trap ───────────────────────────────────────────────────────────────\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction trapFocus(e: KeyboardEvent<HTMLDivElement>, ref: RefObject<HTMLDivElement | null>) {\n if (e.key !== 'Tab') {\n return;\n }\n\n const focusable = Array.from(ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? []);\n\n if (!focusable.length) {\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface PreferencesDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Whether the dialog is open. */\n open: boolean;\n /** Called when the user requests to close the dialog. */\n onClose: () => void;\n /**\n * `PreferencesPage` children. Each page appears as a sidebar entry.\n * When only one page is provided the sidebar is hidden.\n */\n children?: ReactNode;\n /**\n * Whether to show a search bar in the header.\n * When `true` the user can filter group/row content by typing.\n * Defaults to `true`.\n */\n searchable?: boolean;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * Multi-page settings dialog using `PreferencesPage` tabs.\n *\n * Renders a wide modal with an optional sidebar listing pages. Each\n * `PreferencesPage` child becomes a navigation entry. Supports built-in\n * search when `searchable` is `true` (the default).\n *\n * Mirrors `AdwPreferencesDialog`.\n *\n * @example\n * ```tsx\n * <PreferencesDialog open={open} onClose={() => setOpen(false)}>\n * <PreferencesPage title=\"General\" iconName=\"preferences-system-symbolic\">\n * <PreferencesGroup title=\"Appearance\">\n * <BoxedList>\n * <SwitchRow title=\"Dark mode\" />\n * </BoxedList>\n * </PreferencesGroup>\n * </PreferencesPage>\n * </PreferencesDialog>\n * ```\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesDialog.html\n */\nexport const PreferencesDialog = ({\n open,\n onClose,\n children,\n searchable = true,\n className,\n ...props\n}: PreferencesDialogProps) => {\n const dialogRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const titleId = useId();\n\n const pages = Children.toArray(children).filter((c): c is ReactElement<PreferencesPageProps> =>\n isValidElement(c),\n ) as ReactElement<PreferencesPageProps>[];\n\n const [activeIndex, setActiveIndex] = useState(0);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveIndex(0);\n setSearchQuery('');\n // Focus search or first focusable after open animation\n const id = requestAnimationFrame(() => {\n if (searchable && searchRef.current) {\n searchRef.current.focus();\n } else {\n const first = dialogRef.current?.querySelector<HTMLElement>(FOCUSABLE);\n\n first?.focus();\n }\n });\n\n return () => cancelAnimationFrame(id);\n }\n }, [open, searchable]);\n\n // Close on Escape\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n onClose();\n\n return;\n }\n\n trapFocus(e, dialogRef);\n },\n [onClose],\n );\n\n const multiPage = pages.length > 1;\n const activePage = pages[activeIndex] ?? pages[0];\n\n // Filter content by search query\n const query = searchQuery.trim().toLowerCase();\n\n if (!open) {\n return null;\n }\n\n return createPortal(\n <div\n className={styles.backdrop}\n onClick={(e) => {\n if (e.target === e.currentTarget) {\n onClose();\n }\n }}\n role=\"presentation\"\n >\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={[styles.dialog, multiPage ? styles.dialogMulti : null, className]\n .filter(Boolean)\n .join(' ')}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <div className={styles.header}>\n <button\n type=\"button\"\n className={styles.closeBtn}\n onClick={onClose}\n aria-label=\"Close preferences\"\n >\n ✕\n </button>\n <span id={titleId} className={styles.title}>\n Preferences\n </span>\n {searchable && (\n <div className={styles.searchWrap}>\n <input\n ref={searchRef}\n type=\"search\"\n placeholder=\"Search…\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className={styles.searchInput}\n aria-label=\"Search preferences\"\n />\n </div>\n )}\n </div>\n\n {/* ── Body ───────────────────────────────────────────────────────── */}\n <div className={styles.body}>\n {/* Sidebar — only shown when there are multiple pages */}\n {multiPage && (\n <nav className={styles.sidebar} aria-label=\"Preferences pages\">\n <ul className={styles.navList}>\n {pages.map((page, i) => (\n <li key={i} role=\"presentation\">\n <button\n role=\"tab\"\n type=\"button\"\n aria-selected={i === activeIndex}\n className={[styles.navItem, i === activeIndex ? styles.navItemActive : null]\n .filter(Boolean)\n .join(' ')}\n onClick={() => setActiveIndex(i)}\n >\n {page.props.iconName && (\n <span\n className={[styles.navIcon, 'icon', page.props.iconName].join(' ')}\n aria-hidden=\"true\"\n />\n )}\n <span className={styles.navLabel}>{page.props.title}</span>\n </button>\n </li>\n ))}\n </ul>\n </nav>\n )}\n\n {/* Page content */}\n <div className={styles.pageWrap}>\n {activePage &&\n cloneElement(activePage, {\n 'data-search-query': query || undefined,\n } as Partial<PreferencesPageProps>)}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n};\n"],"mappings":"mIAwBA,IAAM,EACJ,2IAEF,SAAS,EAAU,EAAkC,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AS,IAAM,EAAc,EAAA,QAAO,cAAgB,IAAI,EACxE,OAAO,OAAO,EACd,KAAK,GAAG,EACX,YAAe,EAAe,CAAC,WAPjC,CASG,EAAK,MAAM,WACV,EAAA,EAAA,KAAC,OAAD,CACE,UAAW,CAAC,EAAA,QAAO,QAAS,OAAQ,EAAK,MAAM,QAAQ,EAAE,KAAK,GAAG,EACjE,cAAY,MACb,CAAA,GAEH,EAAA,EAAA,KAAC,OAAD,CAAM,UAAW,EAAA,QAAO,kBAAW,EAAK,MAAM,KAAY,CAAA,CACpD,GACN,EAlBK,CAkBL,CACL,CACC,CAAA,CACD,CAAA,GAIP,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,EAAA,QAAO,kBACpB,IAAA,EAAA,EAAA,cACc,EAAY,CACvB,oBAAqB,GAAS,IAAA,EAChC,CAAkC,CACjC,CAAA,CACF,GACF,GACF,CAAA,EACL,SAAS,IACX,EA9FS,IA+FX"}
|
|
@@ -40,4 +40,4 @@ export interface PreferencesDialogProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
40
40
|
*
|
|
41
41
|
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesDialog.html
|
|
42
42
|
*/
|
|
43
|
-
export declare
|
|
43
|
+
export declare const PreferencesDialog: ({ open, onClose, children, searchable, className, ...props }: PreferencesDialogProps) => import('react').ReactPortal | null;
|
|
@@ -11,7 +11,7 @@ function p(e, t) {
|
|
|
11
11
|
let r = n[0], i = n[n.length - 1];
|
|
12
12
|
e.shiftKey ? document.activeElement === r && (e.preventDefault(), i.focus()) : document.activeElement === i && (e.preventDefault(), r.focus());
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
var m = ({ open: m, onClose: h, children: g, searchable: _ = !0, className: v, ...y }) => {
|
|
15
15
|
let b = s(null), x = s(null), S = o(), C = t.toArray(g).filter((e) => r(e)), [w, T] = c(0), [E, D] = c("");
|
|
16
16
|
a(() => {
|
|
17
17
|
if (m) {
|
|
@@ -111,7 +111,7 @@ function m({ open: m, onClose: h, children: g, searchable: _ = !0, className: v,
|
|
|
111
111
|
})]
|
|
112
112
|
})
|
|
113
113
|
}), document.body) : null;
|
|
114
|
-
}
|
|
114
|
+
};
|
|
115
115
|
//#endregion
|
|
116
116
|
export { m as PreferencesDialog };
|
|
117
117
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesDialog.js","names":[],"sources":["../../../src/components/PreferencesDialog/PreferencesDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { PreferencesPageProps } from '../PreferencesPage/PreferencesPage';\n\nimport styles from './PreferencesDialog.module.css';\n\n// ─── Focus trap ───────────────────────────────────────────────────────────────\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction trapFocus(e: KeyboardEvent<HTMLDivElement>, ref: RefObject<HTMLDivElement | null>) {\n if (e.key !== 'Tab') {\n return;\n }\n\n const focusable = Array.from(ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? []);\n\n if (!focusable.length) {\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface PreferencesDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Whether the dialog is open. */\n open: boolean;\n /** Called when the user requests to close the dialog. */\n onClose: () => void;\n /**\n * `PreferencesPage` children. Each page appears as a sidebar entry.\n * When only one page is provided the sidebar is hidden.\n */\n children?: ReactNode;\n /**\n * Whether to show a search bar in the header.\n * When `true` the user can filter group/row content by typing.\n * Defaults to `true`.\n */\n searchable?: boolean;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * Multi-page settings dialog using `PreferencesPage` tabs.\n *\n * Renders a wide modal with an optional sidebar listing pages. Each\n * `PreferencesPage` child becomes a navigation entry. Supports built-in\n * search when `searchable` is `true` (the default).\n *\n * Mirrors `AdwPreferencesDialog`.\n *\n * @example\n * ```tsx\n * <PreferencesDialog open={open} onClose={() => setOpen(false)}>\n * <PreferencesPage title=\"General\" iconName=\"preferences-system-symbolic\">\n * <PreferencesGroup title=\"Appearance\">\n * <BoxedList>\n * <SwitchRow title=\"Dark mode\" />\n * </BoxedList>\n * </PreferencesGroup>\n * </PreferencesPage>\n * </PreferencesDialog>\n * ```\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesDialog.html\n */\nexport function PreferencesDialog({\n open,\n onClose,\n children,\n searchable = true,\n className,\n ...props\n}: PreferencesDialogProps) {\n const dialogRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const titleId = useId();\n\n const pages = Children.toArray(children).filter((c): c is ReactElement<PreferencesPageProps> =>\n isValidElement(c),\n ) as ReactElement<PreferencesPageProps>[];\n\n const [activeIndex, setActiveIndex] = useState(0);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveIndex(0);\n setSearchQuery('');\n // Focus search or first focusable after open animation\n const id = requestAnimationFrame(() => {\n if (searchable && searchRef.current) {\n searchRef.current.focus();\n } else {\n const first = dialogRef.current?.querySelector<HTMLElement>(FOCUSABLE);\n\n first?.focus();\n }\n });\n\n return () => cancelAnimationFrame(id);\n }\n }, [open, searchable]);\n\n // Close on Escape\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n onClose();\n\n return;\n }\n\n trapFocus(e, dialogRef);\n },\n [onClose],\n );\n\n const multiPage = pages.length > 1;\n const activePage = pages[activeIndex] ?? pages[0];\n\n // Filter content by search query\n const query = searchQuery.trim().toLowerCase();\n\n if (!open) {\n return null;\n }\n\n return createPortal(\n <div\n className={styles.backdrop}\n onClick={(e) => {\n if (e.target === e.currentTarget) {\n onClose();\n }\n }}\n role=\"presentation\"\n >\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={[styles.dialog, multiPage ? styles.dialogMulti : null, className]\n .filter(Boolean)\n .join(' ')}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <div className={styles.header}>\n <button\n type=\"button\"\n className={styles.closeBtn}\n onClick={onClose}\n aria-label=\"Close preferences\"\n >\n ✕\n </button>\n <span id={titleId} className={styles.title}>\n Preferences\n </span>\n {searchable && (\n <div className={styles.searchWrap}>\n <input\n ref={searchRef}\n type=\"search\"\n placeholder=\"Search…\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className={styles.searchInput}\n aria-label=\"Search preferences\"\n />\n </div>\n )}\n </div>\n\n {/* ── Body ───────────────────────────────────────────────────────── */}\n <div className={styles.body}>\n {/* Sidebar — only shown when there are multiple pages */}\n {multiPage && (\n <nav className={styles.sidebar} aria-label=\"Preferences pages\">\n <ul className={styles.navList}>\n {pages.map((page, i) => (\n <li key={i} role=\"presentation\">\n <button\n role=\"tab\"\n type=\"button\"\n aria-selected={i === activeIndex}\n className={[styles.navItem, i === activeIndex ? styles.navItemActive : null]\n .filter(Boolean)\n .join(' ')}\n onClick={() => setActiveIndex(i)}\n >\n {page.props.iconName && (\n <span\n className={[styles.navIcon, 'icon', page.props.iconName].join(' ')}\n aria-hidden=\"true\"\n />\n )}\n <span className={styles.navLabel}>{page.props.title}</span>\n </button>\n </li>\n ))}\n </ul>\n </nav>\n )}\n\n {/* Page content */}\n <div className={styles.pageWrap}>\n {activePage &&\n cloneElement(activePage, {\n 'data-search-query': query || undefined,\n } as Partial<PreferencesPageProps>)}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;AAwBA,IAAM,IACJ;AAEF,SAAS,EAAU,GAAkC,GAAuC;AAC1F,KAAI,EAAE,QAAQ,MACZ;CAGF,IAAM,IAAY,MAAM,KAAK,EAAI,SAAS,iBAA8B,EAAU,IAAI,EAAE,CAAC;AAEzF,KAAI,CAAC,EAAU,OACb;CAGF,IAAM,IAAQ,EAAU,IAClB,IAAO,EAAU,EAAU,SAAS;AAE1C,CAAI,EAAE,WACA,SAAS,kBAAkB,MAC7B,EAAE,gBAAgB,EAClB,EAAK,OAAO,IAGV,SAAS,kBAAkB,MAC7B,EAAE,gBAAgB,EAClB,EAAM,OAAO;;AAmDnB,SAAgB,EAAkB,EAChC,SACA,YACA,aACA,gBAAa,IACb,cACA,GAAG,KACsB;CACzB,IAAM,IAAY,EAAuB,KAAK,EACxC,IAAY,EAAyB,KAAK,EAC1C,IAAU,GAAO,EAEjB,IAAQ,EAAS,QAAQ,EAAS,CAAC,QAAQ,MAC/C,EAAe,EAAE,CAClB,EAEK,CAAC,GAAa,KAAkB,EAAS,EAAE,EAC3C,CAAC,GAAa,KAAkB,EAAS,GAAG;AAGlD,SAAgB;AACd,MAAI,GAAM;AAER,GADA,EAAe,EAAE,EACjB,EAAe,GAAG;GAElB,IAAM,IAAK,4BAA4B;AACrC,IAAI,KAAc,EAAU,UAC1B,EAAU,QAAQ,OAAO,IAEX,EAAU,SAAS,cAA2B,EAAU,GAE/D,OAAO;KAEhB;AAEF,gBAAa,qBAAqB,EAAG;;IAEtC,CAAC,GAAM,EAAW,CAAC;CAGtB,IAAM,IAAgB,GACnB,MAAqC;AACpC,MAAI,EAAE,QAAQ,UAAU;AAEtB,GADA,EAAE,iBAAiB,EACnB,GAAS;AAET;;AAGF,IAAU,GAAG,EAAU;IAEzB,CAAC,EAAQ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BAAC,QAAD;SACE,WAAW;UAAC,EAAO;UAAS;UAAQ,EAAK,MAAM;UAAS,CAAC,KAAK,IAAI;SAClE,eAAY;SACZ,CAAA,EAEJ,kBAAC,QAAD;SAAM,WAAW,EAAO;mBAAW,EAAK,MAAM;SAAa,CAAA,CACpD;;OACN,EAlBI,EAkBJ,CACL;MACC,CAAA;KACD,CAAA,EAIR,kBAAC,OAAD;KAAK,WAAW,EAAO;eACpB,KACC,EAAa,GAAY,EACvB,qBAAqB,KAAS,KAAA,GAC/B,CAAkC;KACjC,CAAA,CACF;MACF;;EACF,CAAA,EACN,SAAS,KACV,GA9FQ"}
|
|
1
|
+
{"version":3,"file":"PreferencesDialog.js","names":[],"sources":["../../../src/components/PreferencesDialog/PreferencesDialog.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { PreferencesPageProps } from '../PreferencesPage/PreferencesPage';\n\nimport styles from './PreferencesDialog.module.css';\n\n// ─── Focus trap ───────────────────────────────────────────────────────────────\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction trapFocus(e: KeyboardEvent<HTMLDivElement>, ref: RefObject<HTMLDivElement | null>) {\n if (e.key !== 'Tab') {\n return;\n }\n\n const focusable = Array.from(ref.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? []);\n\n if (!focusable.length) {\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === first) {\n e.preventDefault();\n last.focus();\n }\n } else {\n if (document.activeElement === last) {\n e.preventDefault();\n first.focus();\n }\n }\n}\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport interface PreferencesDialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** Whether the dialog is open. */\n open: boolean;\n /** Called when the user requests to close the dialog. */\n onClose: () => void;\n /**\n * `PreferencesPage` children. Each page appears as a sidebar entry.\n * When only one page is provided the sidebar is hidden.\n */\n children?: ReactNode;\n /**\n * Whether to show a search bar in the header.\n * When `true` the user can filter group/row content by typing.\n * Defaults to `true`.\n */\n searchable?: boolean;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\n/**\n * Multi-page settings dialog using `PreferencesPage` tabs.\n *\n * Renders a wide modal with an optional sidebar listing pages. Each\n * `PreferencesPage` child becomes a navigation entry. Supports built-in\n * search when `searchable` is `true` (the default).\n *\n * Mirrors `AdwPreferencesDialog`.\n *\n * @example\n * ```tsx\n * <PreferencesDialog open={open} onClose={() => setOpen(false)}>\n * <PreferencesPage title=\"General\" iconName=\"preferences-system-symbolic\">\n * <PreferencesGroup title=\"Appearance\">\n * <BoxedList>\n * <SwitchRow title=\"Dark mode\" />\n * </BoxedList>\n * </PreferencesGroup>\n * </PreferencesPage>\n * </PreferencesDialog>\n * ```\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesDialog.html\n */\nexport const PreferencesDialog = ({\n open,\n onClose,\n children,\n searchable = true,\n className,\n ...props\n}: PreferencesDialogProps) => {\n const dialogRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<HTMLInputElement>(null);\n const titleId = useId();\n\n const pages = Children.toArray(children).filter((c): c is ReactElement<PreferencesPageProps> =>\n isValidElement(c),\n ) as ReactElement<PreferencesPageProps>[];\n\n const [activeIndex, setActiveIndex] = useState(0);\n const [searchQuery, setSearchQuery] = useState('');\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveIndex(0);\n setSearchQuery('');\n // Focus search or first focusable after open animation\n const id = requestAnimationFrame(() => {\n if (searchable && searchRef.current) {\n searchRef.current.focus();\n } else {\n const first = dialogRef.current?.querySelector<HTMLElement>(FOCUSABLE);\n\n first?.focus();\n }\n });\n\n return () => cancelAnimationFrame(id);\n }\n }, [open, searchable]);\n\n // Close on Escape\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Escape') {\n e.stopPropagation();\n onClose();\n\n return;\n }\n\n trapFocus(e, dialogRef);\n },\n [onClose],\n );\n\n const multiPage = pages.length > 1;\n const activePage = pages[activeIndex] ?? pages[0];\n\n // Filter content by search query\n const query = searchQuery.trim().toLowerCase();\n\n if (!open) {\n return null;\n }\n\n return createPortal(\n <div\n className={styles.backdrop}\n onClick={(e) => {\n if (e.target === e.currentTarget) {\n onClose();\n }\n }}\n role=\"presentation\"\n >\n <div\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n className={[styles.dialog, multiPage ? styles.dialogMulti : null, className]\n .filter(Boolean)\n .join(' ')}\n onKeyDown={handleKeyDown}\n {...props}\n >\n {/* ── Header ─────────────────────────────────────────────────────── */}\n <div className={styles.header}>\n <button\n type=\"button\"\n className={styles.closeBtn}\n onClick={onClose}\n aria-label=\"Close preferences\"\n >\n ✕\n </button>\n <span id={titleId} className={styles.title}>\n Preferences\n </span>\n {searchable && (\n <div className={styles.searchWrap}>\n <input\n ref={searchRef}\n type=\"search\"\n placeholder=\"Search…\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className={styles.searchInput}\n aria-label=\"Search preferences\"\n />\n </div>\n )}\n </div>\n\n {/* ── Body ───────────────────────────────────────────────────────── */}\n <div className={styles.body}>\n {/* Sidebar — only shown when there are multiple pages */}\n {multiPage && (\n <nav className={styles.sidebar} aria-label=\"Preferences pages\">\n <ul className={styles.navList}>\n {pages.map((page, i) => (\n <li key={i} role=\"presentation\">\n <button\n role=\"tab\"\n type=\"button\"\n aria-selected={i === activeIndex}\n className={[styles.navItem, i === activeIndex ? styles.navItemActive : null]\n .filter(Boolean)\n .join(' ')}\n onClick={() => setActiveIndex(i)}\n >\n {page.props.iconName && (\n <span\n className={[styles.navIcon, 'icon', page.props.iconName].join(' ')}\n aria-hidden=\"true\"\n />\n )}\n <span className={styles.navLabel}>{page.props.title}</span>\n </button>\n </li>\n ))}\n </ul>\n </nav>\n )}\n\n {/* Page content */}\n <div className={styles.pageWrap}>\n {activePage &&\n cloneElement(activePage, {\n 'data-search-query': query || undefined,\n } as Partial<PreferencesPageProps>)}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n};\n"],"mappings":";;;;;AAwBA,IAAM,IACJ;AAEF,SAAS,EAAU,GAAkC,GAAuC;CAC1F,IAAI,EAAE,QAAQ,OACZ;CAGF,IAAM,IAAY,MAAM,KAAK,EAAI,SAAS,iBAA8B,CAAS,KAAK,CAAC,CAAC;CAExF,IAAI,CAAC,EAAU,QACb;CAGF,IAAM,IAAQ,EAAU,IAClB,IAAO,EAAU,EAAU,SAAS;CAE1C,AAAI,EAAE,WACA,SAAS,kBAAkB,MAC7B,EAAE,eAAe,GACjB,EAAK,MAAM,KAGT,SAAS,kBAAkB,MAC7B,EAAE,eAAe,GACjB,EAAM,MAAM;AAGlB;AAgDA,IAAa,KAAqB,EAChC,SACA,YACA,aACA,gBAAa,IACb,cACA,GAAG,QACyB;CAC5B,IAAM,IAAY,EAAuB,IAAI,GACvC,IAAY,EAAyB,IAAI,GACzC,IAAU,EAAM,GAEhB,IAAQ,EAAS,QAAQ,CAAQ,EAAE,QAAQ,MAC/C,EAAe,CAAC,CAClB,GAEM,CAAC,GAAa,KAAkB,EAAS,CAAC,GAC1C,CAAC,GAAa,KAAkB,EAAS,EAAE;CAGjD,QAAgB;EACd,IAAI,GAAM;GAER,AADA,EAAe,CAAC,GAChB,EAAe,EAAE;GAEjB,IAAM,IAAK,4BAA4B;IACrC,AAAI,KAAc,EAAU,UAC1B,EAAU,QAAQ,MAAM,KAEV,EAAU,SAAS,cAA2B,CAAS,IAE9D,MAAM;GAEjB,CAAC;GAED,aAAa,qBAAqB,CAAE;EACtC;CACF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D;QACE,MAAK;QACL,MAAK;QACL,iBAAe,MAAM;QACrB,WAAW,CAAC,EAAO,SAAS,MAAM,IAAc,EAAO,gBAAgB,IAAI,EACxE,OAAO,OAAO,EACd,KAAK,GAAG;QACX,eAAe,EAAe,CAAC;kBAPjC,CASG,EAAK,MAAM,YACV,kBAAC,QAAD;SACE,WAAW;UAAC,EAAO;UAAS;UAAQ,EAAK,MAAM;SAAQ,EAAE,KAAK,GAAG;SACjE,eAAY;QACb,CAAA,GAEH,kBAAC,QAAD;SAAM,WAAW,EAAO;mBAAW,EAAK,MAAM;QAAY,CAAA,CACpD;;MACN,GAlBK,CAkBL,CACL;KACC,CAAA;IACD,CAAA,GAIP,kBAAC,OAAD;KAAK,WAAW,EAAO;eACpB,KACC,EAAa,GAAY,EACvB,qBAAqB,KAAS,KAAA,EAChC,CAAkC;IACjC,CAAA,CACF;KACF;;CACF,CAAA,GACL,SAAS,IACX,IA9FS;AA+FX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e
|
|
1
|
+
var e={backdrop:`_backdrop_1k5wp_3`,"backdrop-in":`_backdrop-in_1k5wp_1`,dialog:`_dialog_1k5wp_30`,"dialog-in":`_dialog-in_1k5wp_1`,dialogMulti:`_dialogMulti_1k5wp_50`,header:`_header_1k5wp_67`,closeBtn:`_closeBtn_1k5wp_78`,title:`_title_1k5wp_108`,searchWrap:`_searchWrap_1k5wp_118`,searchInput:`_searchInput_1k5wp_122`,body:`_body_1k5wp_151`,sidebar:`_sidebar_1k5wp_160`,navList:`_navList_1k5wp_168`,navItem:`_navItem_1k5wp_177`,navItemActive:`_navItemActive_1k5wp_198`,navIcon:`_navIcon_1k5wp_213`,navLabel:`_navLabel_1k5wp_219`,pageWrap:`_pageWrap_1k5wp_229`};exports.default=e;
|
|
2
2
|
//# sourceMappingURL=PreferencesDialog.module.css.cjs.map
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
backdrop: e,
|
|
1
|
+
var e = {
|
|
2
|
+
backdrop: "_backdrop_1k5wp_3",
|
|
4
3
|
"backdrop-in": "_backdrop-in_1k5wp_1",
|
|
5
|
-
dialog:
|
|
4
|
+
dialog: "_dialog_1k5wp_30",
|
|
6
5
|
"dialog-in": "_dialog-in_1k5wp_1",
|
|
7
|
-
dialogMulti:
|
|
8
|
-
header:
|
|
9
|
-
closeBtn:
|
|
10
|
-
title:
|
|
11
|
-
searchWrap:
|
|
12
|
-
searchInput:
|
|
13
|
-
body:
|
|
14
|
-
sidebar:
|
|
15
|
-
navList:
|
|
16
|
-
navItem:
|
|
17
|
-
navItemActive:
|
|
18
|
-
navIcon:
|
|
19
|
-
navLabel:
|
|
20
|
-
pageWrap:
|
|
6
|
+
dialogMulti: "_dialogMulti_1k5wp_50",
|
|
7
|
+
header: "_header_1k5wp_67",
|
|
8
|
+
closeBtn: "_closeBtn_1k5wp_78",
|
|
9
|
+
title: "_title_1k5wp_108",
|
|
10
|
+
searchWrap: "_searchWrap_1k5wp_118",
|
|
11
|
+
searchInput: "_searchInput_1k5wp_122",
|
|
12
|
+
body: "_body_1k5wp_151",
|
|
13
|
+
sidebar: "_sidebar_1k5wp_160",
|
|
14
|
+
navList: "_navList_1k5wp_168",
|
|
15
|
+
navItem: "_navItem_1k5wp_177",
|
|
16
|
+
navItemActive: "_navItemActive_1k5wp_198",
|
|
17
|
+
navIcon: "_navIcon_1k5wp_213",
|
|
18
|
+
navLabel: "_navLabel_1k5wp_219",
|
|
19
|
+
pageWrap: "_pageWrap_1k5wp_229"
|
|
21
20
|
};
|
|
22
21
|
//#endregion
|
|
23
|
-
export {
|
|
22
|
+
export { e as default };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=PreferencesDialog.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./PreferencesDialog/PreferencesDialog.cjs");exports.PreferencesDialog=e.PreferencesDialog;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require("./PreferencesGroup.module.css.cjs");let t=require("react/jsx-runtime");var n=({title:n,description:r,headerSuffix:i,children:a,className:o,...s})=>{let c=n||r||i;return(0,t.jsxs)(`div`,{className:[e.default.group,o].filter(Boolean).join(` `),...s,children:[c&&(0,t.jsxs)(`div`,{className:e.default.header,children:[(0,t.jsxs)(`div`,{className:e.default.headerText,children:[n&&(0,t.jsx)(`span`,{className:e.default.title,children:n}),r&&(0,t.jsx)(`span`,{className:e.default.description,children:r})]}),i&&(0,t.jsx)(`div`,{className:e.default.suffix,children:i})]}),(0,t.jsx)(`div`,{className:e.default.content,children:a})]})};exports.PreferencesGroup=n;
|
|
2
2
|
//# sourceMappingURL=PreferencesGroup.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesGroup.cjs","names":[],"sources":["../../../src/components/PreferencesGroup/PreferencesGroup.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesGroup.module.css';\n\nexport interface PreferencesGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Group heading. */\n title?: string;\n /** Optional description rendered below the title. */\n description?: string;\n /** Widget placed at the trailing edge of the title row (e.g. a reset Button). */\n headerSuffix?: ReactNode;\n /** `BoxedList` rows or any row-shaped content. */\n children?: ReactNode;\n}\n\n/**\n * Titled section that wraps a `BoxedList` with an optional description.\n *\n * Use inside a `PreferencesPage` to group related settings under a named\n * heading. The group is purely a layout and labelling wrapper — it does not\n * render the `BoxedList` itself; pass it as `children`.\n *\n * Mirrors `AdwPreferencesGroup`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesGroup.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"PreferencesGroup.cjs","names":[],"sources":["../../../src/components/PreferencesGroup/PreferencesGroup.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesGroup.module.css';\n\nexport interface PreferencesGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Group heading. */\n title?: string;\n /** Optional description rendered below the title. */\n description?: string;\n /** Widget placed at the trailing edge of the title row (e.g. a reset Button). */\n headerSuffix?: ReactNode;\n /** `BoxedList` rows or any row-shaped content. */\n children?: ReactNode;\n}\n\n/**\n * Titled section that wraps a `BoxedList` with an optional description.\n *\n * Use inside a `PreferencesPage` to group related settings under a named\n * heading. The group is purely a layout and labelling wrapper — it does not\n * render the `BoxedList` itself; pass it as `children`.\n *\n * Mirrors `AdwPreferencesGroup`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesGroup.html\n */\nexport const PreferencesGroup = ({\n title,\n description,\n headerSuffix,\n children,\n className,\n ...props\n}: PreferencesGroupProps) => {\n const hasHeader = title || description || headerSuffix;\n\n return (\n <div className={[styles.group, className].filter(Boolean).join(' ')} {...props}>\n {hasHeader && (\n <div className={styles.header}>\n <div className={styles.headerText}>\n {title && <span className={styles.title}>{title}</span>}\n {description && <span className={styles.description}>{description}</span>}\n </div>\n {headerSuffix && <div className={styles.suffix}>{headerSuffix}</div>}\n </div>\n )}\n <div className={styles.content}>{children}</div>\n </div>\n );\n};\n"],"mappings":"wFA0BA,IAAa,GAAoB,CAC/B,QACA,cACA,eACA,WACA,YACA,GAAG,KACwB,CAC3B,IAAM,EAAY,GAAS,GAAe,EAE1C,OACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAW,CAAC,EAAA,QAAO,MAAO,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAG,GAAI,WAAzE,CACG,IACC,EAAA,EAAA,MAAC,MAAD,CAAK,UAAW,EAAA,QAAO,gBAAvB,EACE,EAAA,EAAA,MAAC,MAAD,CAAK,UAAW,EAAA,QAAO,oBAAvB,CACG,IAAS,EAAA,EAAA,KAAC,OAAD,CAAM,UAAW,EAAA,QAAO,eAAQ,CAAY,CAAA,EACrD,IAAe,EAAA,EAAA,KAAC,OAAD,CAAM,UAAW,EAAA,QAAO,qBAAc,CAAkB,CAAA,CACrE,IACJ,IAAgB,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,EAAA,QAAO,gBAAS,CAAkB,CAAA,CAChE,KAEP,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,EAAA,QAAO,QAAU,UAAc,CAAA,CAC5C,GAET"}
|
|
@@ -20,4 +20,4 @@ export interface PreferencesGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesGroup.html
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare const PreferencesGroup: ({ title, description, headerSuffix, children, className, ...props }: PreferencesGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./PreferencesGroup.module.css.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/PreferencesGroup/PreferencesGroup.tsx
|
|
4
|
-
|
|
4
|
+
var r = ({ title: r, description: i, headerSuffix: a, children: o, className: s, ...c }) => {
|
|
5
5
|
let l = r || i || a;
|
|
6
6
|
return /* @__PURE__ */ n("div", {
|
|
7
7
|
className: [e.group, s].filter(Boolean).join(" "),
|
|
@@ -26,7 +26,7 @@ function r({ title: r, description: i, headerSuffix: a, children: o, className:
|
|
|
26
26
|
children: o
|
|
27
27
|
})]
|
|
28
28
|
});
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
//#endregion
|
|
31
31
|
export { r as PreferencesGroup };
|
|
32
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesGroup.js","names":[],"sources":["../../../src/components/PreferencesGroup/PreferencesGroup.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesGroup.module.css';\n\nexport interface PreferencesGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Group heading. */\n title?: string;\n /** Optional description rendered below the title. */\n description?: string;\n /** Widget placed at the trailing edge of the title row (e.g. a reset Button). */\n headerSuffix?: ReactNode;\n /** `BoxedList` rows or any row-shaped content. */\n children?: ReactNode;\n}\n\n/**\n * Titled section that wraps a `BoxedList` with an optional description.\n *\n * Use inside a `PreferencesPage` to group related settings under a named\n * heading. The group is purely a layout and labelling wrapper — it does not\n * render the `BoxedList` itself; pass it as `children`.\n *\n * Mirrors `AdwPreferencesGroup`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesGroup.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"PreferencesGroup.js","names":[],"sources":["../../../src/components/PreferencesGroup/PreferencesGroup.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesGroup.module.css';\n\nexport interface PreferencesGroupProps extends HTMLAttributes<HTMLDivElement> {\n /** Group heading. */\n title?: string;\n /** Optional description rendered below the title. */\n description?: string;\n /** Widget placed at the trailing edge of the title row (e.g. a reset Button). */\n headerSuffix?: ReactNode;\n /** `BoxedList` rows or any row-shaped content. */\n children?: ReactNode;\n}\n\n/**\n * Titled section that wraps a `BoxedList` with an optional description.\n *\n * Use inside a `PreferencesPage` to group related settings under a named\n * heading. The group is purely a layout and labelling wrapper — it does not\n * render the `BoxedList` itself; pass it as `children`.\n *\n * Mirrors `AdwPreferencesGroup`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesGroup.html\n */\nexport const PreferencesGroup = ({\n title,\n description,\n headerSuffix,\n children,\n className,\n ...props\n}: PreferencesGroupProps) => {\n const hasHeader = title || description || headerSuffix;\n\n return (\n <div className={[styles.group, className].filter(Boolean).join(' ')} {...props}>\n {hasHeader && (\n <div className={styles.header}>\n <div className={styles.headerText}>\n {title && <span className={styles.title}>{title}</span>}\n {description && <span className={styles.description}>{description}</span>}\n </div>\n {headerSuffix && <div className={styles.suffix}>{headerSuffix}</div>}\n </div>\n )}\n <div className={styles.content}>{children}</div>\n </div>\n );\n};\n"],"mappings":";;;AA0BA,IAAa,KAAoB,EAC/B,UACA,gBACA,iBACA,aACA,cACA,GAAG,QACwB;CAC3B,IAAM,IAAY,KAAS,KAAe;CAE1C,OACE,kBAAC,OAAD;EAAK,WAAW,CAAC,EAAO,OAAO,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;EAAG,GAAI;YAAzE,CACG,KACC,kBAAC,OAAD;GAAK,WAAW,EAAO;aAAvB,CACE,kBAAC,OAAD;IAAK,WAAW,EAAO;cAAvB,CACG,KAAS,kBAAC,QAAD;KAAM,WAAW,EAAO;eAAQ;IAAY,CAAA,GACrD,KAAe,kBAAC,QAAD;KAAM,WAAW,EAAO;eAAc;IAAkB,CAAA,CACrE;OACJ,KAAgB,kBAAC,OAAD;IAAK,WAAW,EAAO;cAAS;GAAkB,CAAA,CAChE;MAEP,kBAAC,OAAD;GAAK,WAAW,EAAO;GAAU;EAAc,CAAA,CAC5C;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./PreferencesGroup/PreferencesGroup.cjs");exports.PreferencesGroup=e.PreferencesGroup;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require("./PreferencesPage.module.css.cjs");let t=require("react/jsx-runtime");var n=({title:n,iconName:r,children:i,className:a,...o})=>(0,t.jsx)(`div`,{className:[e.default.page,a].filter(Boolean).join(` `),role:`tabpanel`,...o,children:(0,t.jsx)(`div`,{className:e.default.inner,children:i})});exports.PreferencesPage=n;
|
|
2
2
|
//# sourceMappingURL=PreferencesPage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesPage.cjs","names":[],"sources":["../../../src/components/PreferencesPage/PreferencesPage.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesPage.module.css';\n\nexport interface PreferencesPageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Page title shown in the sidebar / tab of a `PreferencesDialog`.\n * Required — used as the navigation label.\n */\n title: string;\n /**\n * Name of a symbolic icon displayed next to the page title in the sidebar.\n * Pass a valid icon name from the system icon theme (e.g. `\"preferences-system-symbolic\"`).\n */\n iconName?: string;\n /** `PreferencesGroup` sections. */\n children?: ReactNode;\n}\n\n/**\n * Scrollable page composed of `PreferencesGroup` sections.\n *\n * Use as a child of `PreferencesDialog`. Each page appears as a labelled\n * navigation entry in the dialog sidebar.\n *\n * Mirrors `AdwPreferencesPage`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesPage.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"PreferencesPage.cjs","names":[],"sources":["../../../src/components/PreferencesPage/PreferencesPage.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesPage.module.css';\n\nexport interface PreferencesPageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Page title shown in the sidebar / tab of a `PreferencesDialog`.\n * Required — used as the navigation label.\n */\n title: string;\n /**\n * Name of a symbolic icon displayed next to the page title in the sidebar.\n * Pass a valid icon name from the system icon theme (e.g. `\"preferences-system-symbolic\"`).\n */\n iconName?: string;\n /** `PreferencesGroup` sections. */\n children?: ReactNode;\n}\n\n/**\n * Scrollable page composed of `PreferencesGroup` sections.\n *\n * Use as a child of `PreferencesDialog`. Each page appears as a labelled\n * navigation entry in the dialog sidebar.\n *\n * Mirrors `AdwPreferencesPage`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesPage.html\n */\nexport const PreferencesPage = ({\n title: _title,\n iconName: _iconName,\n children,\n className,\n ...props\n}: PreferencesPageProps) => {\n return (\n <div className={[styles.page, className].filter(Boolean).join(' ')} role=\"tabpanel\" {...props}>\n <div className={styles.inner}>{children}</div>\n </div>\n );\n};\n"],"mappings":"uFA6BA,IAAa,GAAmB,CAC9B,MAAO,EACP,SAAU,EACV,WACA,YACA,GAAG,MAGD,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,CAAC,EAAA,QAAO,KAAM,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAG,KAAK,WAAW,GAAI,YACtF,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,EAAA,QAAO,MAAQ,UAAc,CAAA,CAC1C,CAAA"}
|
|
@@ -23,4 +23,4 @@ export interface PreferencesPageProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesPage.html
|
|
25
25
|
*/
|
|
26
|
-
export declare
|
|
26
|
+
export declare const PreferencesPage: ({ title: _title, iconName: _iconName, children, className, ...props }: PreferencesPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import e from "./PreferencesPage.module.css.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/PreferencesPage/PreferencesPage.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
}
|
|
4
|
+
var n = ({ title: n, iconName: r, children: i, className: a, ...o }) => /* @__PURE__ */ t("div", {
|
|
5
|
+
className: [e.page, a].filter(Boolean).join(" "),
|
|
6
|
+
role: "tabpanel",
|
|
7
|
+
...o,
|
|
8
|
+
children: /* @__PURE__ */ t("div", {
|
|
9
|
+
className: e.inner,
|
|
10
|
+
children: i
|
|
11
|
+
})
|
|
12
|
+
});
|
|
15
13
|
//#endregion
|
|
16
14
|
export { n as PreferencesPage };
|
|
17
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesPage.js","names":[],"sources":["../../../src/components/PreferencesPage/PreferencesPage.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesPage.module.css';\n\nexport interface PreferencesPageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Page title shown in the sidebar / tab of a `PreferencesDialog`.\n * Required — used as the navigation label.\n */\n title: string;\n /**\n * Name of a symbolic icon displayed next to the page title in the sidebar.\n * Pass a valid icon name from the system icon theme (e.g. `\"preferences-system-symbolic\"`).\n */\n iconName?: string;\n /** `PreferencesGroup` sections. */\n children?: ReactNode;\n}\n\n/**\n * Scrollable page composed of `PreferencesGroup` sections.\n *\n * Use as a child of `PreferencesDialog`. Each page appears as a labelled\n * navigation entry in the dialog sidebar.\n *\n * Mirrors `AdwPreferencesPage`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesPage.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"PreferencesPage.js","names":[],"sources":["../../../src/components/PreferencesPage/PreferencesPage.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\n\nimport styles from './PreferencesPage.module.css';\n\nexport interface PreferencesPageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Page title shown in the sidebar / tab of a `PreferencesDialog`.\n * Required — used as the navigation label.\n */\n title: string;\n /**\n * Name of a symbolic icon displayed next to the page title in the sidebar.\n * Pass a valid icon name from the system icon theme (e.g. `\"preferences-system-symbolic\"`).\n */\n iconName?: string;\n /** `PreferencesGroup` sections. */\n children?: ReactNode;\n}\n\n/**\n * Scrollable page composed of `PreferencesGroup` sections.\n *\n * Use as a child of `PreferencesDialog`. Each page appears as a labelled\n * navigation entry in the dialog sidebar.\n *\n * Mirrors `AdwPreferencesPage`.\n *\n * @see https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.PreferencesPage.html\n */\nexport const PreferencesPage = ({\n title: _title,\n iconName: _iconName,\n children,\n className,\n ...props\n}: PreferencesPageProps) => {\n return (\n <div className={[styles.page, className].filter(Boolean).join(' ')} role=\"tabpanel\" {...props}>\n <div className={styles.inner}>{children}</div>\n </div>\n );\n};\n"],"mappings":";;;AA6BA,IAAa,KAAmB,EAC9B,OAAO,GACP,UAAU,GACV,aACA,cACA,GAAG,QAGD,kBAAC,OAAD;CAAK,WAAW,CAAC,EAAO,MAAM,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;CAAG,MAAK;CAAW,GAAI;WACtF,kBAAC,OAAD;EAAK,WAAW,EAAO;EAAQ;CAAc,CAAA;AAC1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./PreferencesPage/PreferencesPage.cjs");exports.PreferencesPage=e.PreferencesPage;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require("./ProgressBar.module.css.cjs");let t=require("react/jsx-runtime");var n=({value:n,variant:r=`accent`,className:i,"aria-label":a,"aria-labelledby":o,...s})=>{let c=n==null,l=c?void 0:Math.min(1,Math.max(0,n)),u=l===void 0?void 0:l*100;return(0,t.jsx)(`div`,{role:`progressbar`,"aria-label":a,"aria-labelledby":o,"aria-valuenow":l===void 0?void 0:Math.round(u),"aria-valuemin":c?void 0:0,"aria-valuemax":c?void 0:100,className:[e.default.track,i].filter(Boolean).join(` `),...s,children:(0,t.jsx)(`div`,{className:[e.default.fill,e.default[r],c?e.default.indeterminate:null].filter(Boolean).join(` `),style:c?void 0:{width:`${u}%`}})})};exports.ProgressBar=n;
|
|
2
2
|
//# sourceMappingURL=ProgressBar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.cjs","names":[],"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport styles from './ProgressBar.module.css';\n\nexport type ProgressBarVariant = 'accent' | 'success' | 'warning' | 'error';\n\nexport interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value between `0` and `1` (e.g. `0.6` = 60 %).\n * Omit or set to `undefined` for the indeterminate (pulsing) state.\n */\n value?: number;\n /**\n * Fill color of the progress indicator.\n * - `\"accent\"` (default) — blue, general-purpose progress.\n * - `\"success\"` — green, completed or healthy state.\n * - `\"warning\"` — yellow, approaching a limit.\n * - `\"error\"` — red, failed or critical state.\n */\n variant?: ProgressBarVariant;\n /** Accessible label describing what is loading. */\n 'aria-label'?: string;\n /** Associates the bar with a visible element that labels it. */\n 'aria-labelledby'?: string;\n}\n\n/**\n * Determinate and indeterminate progress bar following the Adwaita style.\n *\n * - **Determinate** — pass `value` (0–1) to show exact progress.\n * - **Indeterminate** — omit `value` for an animated pulse when duration is unknown.\n *\n * Renders as `role=\"progressbar\"` with `aria-valuenow` / `aria-valuemin` /\n * `aria-valuemax` for screen readers.\n *\n * @see https://developer.gnome.org/hig/patterns/feedback/progress.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"ProgressBar.cjs","names":[],"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport styles from './ProgressBar.module.css';\n\nexport type ProgressBarVariant = 'accent' | 'success' | 'warning' | 'error';\n\nexport interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value between `0` and `1` (e.g. `0.6` = 60 %).\n * Omit or set to `undefined` for the indeterminate (pulsing) state.\n */\n value?: number;\n /**\n * Fill color of the progress indicator.\n * - `\"accent\"` (default) — blue, general-purpose progress.\n * - `\"success\"` — green, completed or healthy state.\n * - `\"warning\"` — yellow, approaching a limit.\n * - `\"error\"` — red, failed or critical state.\n */\n variant?: ProgressBarVariant;\n /** Accessible label describing what is loading. */\n 'aria-label'?: string;\n /** Associates the bar with a visible element that labels it. */\n 'aria-labelledby'?: string;\n}\n\n/**\n * Determinate and indeterminate progress bar following the Adwaita style.\n *\n * - **Determinate** — pass `value` (0–1) to show exact progress.\n * - **Indeterminate** — omit `value` for an animated pulse when duration is unknown.\n *\n * Renders as `role=\"progressbar\"` with `aria-valuenow` / `aria-valuemin` /\n * `aria-valuemax` for screen readers.\n *\n * @see https://developer.gnome.org/hig/patterns/feedback/progress.html\n */\nexport const ProgressBar = ({\n value,\n variant = 'accent',\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n}: ProgressBarProps) => {\n const isIndeterminate = value === undefined || value === null;\n const clamped = isIndeterminate ? undefined : Math.min(1, Math.max(0, value));\n const percent = clamped !== undefined ? clamped * 100 : undefined;\n\n return (\n <div\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-valuenow={clamped !== undefined ? Math.round(percent!) : undefined}\n aria-valuemin={isIndeterminate ? undefined : 0}\n aria-valuemax={isIndeterminate ? undefined : 100}\n className={[styles.track, className].filter(Boolean).join(' ')}\n {...props}\n >\n <div\n className={[styles.fill, styles[variant], isIndeterminate ? styles.indeterminate : null]\n .filter(Boolean)\n .join(' ')}\n style={!isIndeterminate ? { width: `${percent}%` } : undefined}\n />\n </div>\n );\n};\n"],"mappings":"mFAqCA,IAAa,GAAe,CAC1B,QACA,UAAU,SACV,YACA,aAAc,EACd,kBAAmB,EACnB,GAAG,KACmB,CACtB,IAAM,EAAkB,GAAiC,KACnD,EAAU,EAAkB,IAAA,GAAY,KAAK,IAAI,EAAG,KAAK,IAAI,EAAG,CAAK,CAAC,EACtE,EAAU,IAAY,IAAA,GAA4B,IAAA,GAAhB,EAAU,IAElD,OACE,EAAA,EAAA,KAAC,MAAD,CACE,KAAK,cACL,aAAY,EACZ,kBAAiB,EACjB,gBAAe,IAAY,IAAA,GAAmC,IAAA,GAAvB,KAAK,MAAM,CAAQ,EAC1D,gBAAe,EAAkB,IAAA,GAAY,EAC7C,gBAAe,EAAkB,IAAA,GAAY,IAC7C,UAAW,CAAC,EAAA,QAAO,MAAO,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAC7D,GAAI,YAEJ,EAAA,EAAA,KAAC,MAAD,CACE,UAAW,CAAC,EAAA,QAAO,KAAM,EAAA,QAAO,GAAU,EAAkB,EAAA,QAAO,cAAgB,IAAI,EACpF,OAAO,OAAO,EACd,KAAK,GAAG,EACX,MAAQ,EAA6C,IAAA,GAA3B,CAAE,MAAO,GAAG,EAAQ,EAAG,CAClD,CAAA,CACE,CAAA,CAET"}
|
|
@@ -30,4 +30,4 @@ export interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
30
30
|
*
|
|
31
31
|
* @see https://developer.gnome.org/hig/patterns/feedback/progress.html
|
|
32
32
|
*/
|
|
33
|
-
export declare
|
|
33
|
+
export declare const ProgressBar: ({ value, variant, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./ProgressBar.module.css.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/ProgressBar/ProgressBar.tsx
|
|
4
|
-
|
|
4
|
+
var n = ({ value: n, variant: r = "accent", className: i, "aria-label": a, "aria-labelledby": o, ...s }) => {
|
|
5
5
|
let c = n == null, l = c ? void 0 : Math.min(1, Math.max(0, n)), u = l === void 0 ? void 0 : l * 100;
|
|
6
6
|
return /* @__PURE__ */ t("div", {
|
|
7
7
|
role: "progressbar",
|
|
@@ -21,7 +21,7 @@ function n({ value: n, variant: r = "accent", className: i, "aria-label": a, "ar
|
|
|
21
21
|
style: c ? void 0 : { width: `${u}%` }
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { n as ProgressBar };
|
|
27
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","names":[],"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport styles from './ProgressBar.module.css';\n\nexport type ProgressBarVariant = 'accent' | 'success' | 'warning' | 'error';\n\nexport interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value between `0` and `1` (e.g. `0.6` = 60 %).\n * Omit or set to `undefined` for the indeterminate (pulsing) state.\n */\n value?: number;\n /**\n * Fill color of the progress indicator.\n * - `\"accent\"` (default) — blue, general-purpose progress.\n * - `\"success\"` — green, completed or healthy state.\n * - `\"warning\"` — yellow, approaching a limit.\n * - `\"error\"` — red, failed or critical state.\n */\n variant?: ProgressBarVariant;\n /** Accessible label describing what is loading. */\n 'aria-label'?: string;\n /** Associates the bar with a visible element that labels it. */\n 'aria-labelledby'?: string;\n}\n\n/**\n * Determinate and indeterminate progress bar following the Adwaita style.\n *\n * - **Determinate** — pass `value` (0–1) to show exact progress.\n * - **Indeterminate** — omit `value` for an animated pulse when duration is unknown.\n *\n * Renders as `role=\"progressbar\"` with `aria-valuenow` / `aria-valuemin` /\n * `aria-valuemax` for screen readers.\n *\n * @see https://developer.gnome.org/hig/patterns/feedback/progress.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","names":[],"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport styles from './ProgressBar.module.css';\n\nexport type ProgressBarVariant = 'accent' | 'success' | 'warning' | 'error';\n\nexport interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Current progress value between `0` and `1` (e.g. `0.6` = 60 %).\n * Omit or set to `undefined` for the indeterminate (pulsing) state.\n */\n value?: number;\n /**\n * Fill color of the progress indicator.\n * - `\"accent\"` (default) — blue, general-purpose progress.\n * - `\"success\"` — green, completed or healthy state.\n * - `\"warning\"` — yellow, approaching a limit.\n * - `\"error\"` — red, failed or critical state.\n */\n variant?: ProgressBarVariant;\n /** Accessible label describing what is loading. */\n 'aria-label'?: string;\n /** Associates the bar with a visible element that labels it. */\n 'aria-labelledby'?: string;\n}\n\n/**\n * Determinate and indeterminate progress bar following the Adwaita style.\n *\n * - **Determinate** — pass `value` (0–1) to show exact progress.\n * - **Indeterminate** — omit `value` for an animated pulse when duration is unknown.\n *\n * Renders as `role=\"progressbar\"` with `aria-valuenow` / `aria-valuemin` /\n * `aria-valuemax` for screen readers.\n *\n * @see https://developer.gnome.org/hig/patterns/feedback/progress.html\n */\nexport const ProgressBar = ({\n value,\n variant = 'accent',\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n}: ProgressBarProps) => {\n const isIndeterminate = value === undefined || value === null;\n const clamped = isIndeterminate ? undefined : Math.min(1, Math.max(0, value));\n const percent = clamped !== undefined ? clamped * 100 : undefined;\n\n return (\n <div\n role=\"progressbar\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-valuenow={clamped !== undefined ? Math.round(percent!) : undefined}\n aria-valuemin={isIndeterminate ? undefined : 0}\n aria-valuemax={isIndeterminate ? undefined : 100}\n className={[styles.track, className].filter(Boolean).join(' ')}\n {...props}\n >\n <div\n className={[styles.fill, styles[variant], isIndeterminate ? styles.indeterminate : null]\n .filter(Boolean)\n .join(' ')}\n style={!isIndeterminate ? { width: `${percent}%` } : undefined}\n />\n </div>\n );\n};\n"],"mappings":";;;AAqCA,IAAa,KAAe,EAC1B,UACA,aAAU,UACV,cACA,cAAc,GACd,mBAAmB,GACnB,GAAG,QACmB;CACtB,IAAM,IAAkB,KAAiC,MACnD,IAAU,IAAkB,KAAA,IAAY,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAK,CAAC,GACtE,IAAU,MAAY,KAAA,IAA4B,KAAA,IAAhB,IAAU;CAElD,OACE,kBAAC,OAAD;EACE,MAAK;EACL,cAAY;EACZ,mBAAiB;EACjB,iBAAe,MAAY,KAAA,IAAmC,KAAA,IAAvB,KAAK,MAAM,CAAQ;EAC1D,iBAAe,IAAkB,KAAA,IAAY;EAC7C,iBAAe,IAAkB,KAAA,IAAY;EAC7C,WAAW,CAAC,EAAO,OAAO,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;EAC7D,GAAI;YAEJ,kBAAC,OAAD;GACE,WAAW;IAAC,EAAO;IAAM,EAAO;IAAU,IAAkB,EAAO,gBAAgB;GAAI,EACpF,OAAO,OAAO,EACd,KAAK,GAAG;GACX,OAAQ,IAA6C,KAAA,IAA3B,EAAE,OAAO,GAAG,EAAQ,GAAG;EAClD,CAAA;CACE,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./ProgressBar/ProgressBar.cjs");exports.ProgressBar=e.ProgressBar;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require("./RadioButton.module.css.cjs");let t=require("react/jsx-runtime");var n=({className:n,...r})=>(0,t.jsx)(`input`,{type:`radio`,className:[e.default.radio,n].filter(Boolean).join(` `),...r});exports.RadioButton=n;
|
|
2
2
|
//# sourceMappingURL=RadioButton.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.cjs","names":[],"sources":["../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import type { InputHTMLAttributes } from 'react';\n\nimport styles from './RadioButton.module.css';\n\nexport interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {\n /** Accessible label. Required when no visible `<label>` is associated. */\n 'aria-label'?: string;\n}\n\n/**\n * Single-selection radio button following the GNOME HIG and Adwaita style.\n *\n * Group radio buttons by giving them the same `name` attribute.\n * Renders as `<input type=\"radio\">` — natively keyboard-accessible\n * (arrow keys cycle within the group) and compatible with standard form libraries.\n *\n * @see https://developer.gnome.org/hig/patterns/controls/radio-buttons.html\n */\nexport
|
|
1
|
+
{"version":3,"file":"RadioButton.cjs","names":[],"sources":["../../../src/components/RadioButton/RadioButton.tsx"],"sourcesContent":["import type { InputHTMLAttributes } from 'react';\n\nimport styles from './RadioButton.module.css';\n\nexport interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {\n /** Accessible label. Required when no visible `<label>` is associated. */\n 'aria-label'?: string;\n}\n\n/**\n * Single-selection radio button following the GNOME HIG and Adwaita style.\n *\n * Group radio buttons by giving them the same `name` attribute.\n * Renders as `<input type=\"radio\">` — natively keyboard-accessible\n * (arrow keys cycle within the group) and compatible with standard form libraries.\n *\n * @see https://developer.gnome.org/hig/patterns/controls/radio-buttons.html\n */\nexport const RadioButton = ({ className, ...props }: RadioButtonProps) => {\n return (\n <input\n type=\"radio\"\n className={[styles.radio, className].filter(Boolean).join(' ')}\n {...props}\n />\n );\n};\n"],"mappings":"mFAkBA,IAAa,GAAe,CAAE,YAAW,GAAG,MAExC,EAAA,EAAA,KAAC,QAAD,CACE,KAAK,QACL,UAAW,CAAC,EAAA,QAAO,MAAO,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAC7D,GAAI,CACL,CAAA"}
|
|
@@ -12,4 +12,4 @@ export interface RadioButtonProps extends Omit<InputHTMLAttributes<HTMLInputElem
|
|
|
12
12
|
*
|
|
13
13
|
* @see https://developer.gnome.org/hig/patterns/controls/radio-buttons.html
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const RadioButton: ({ className, ...props }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import e from "./RadioButton.module.css.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/RadioButton/RadioButton.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
}
|
|
4
|
+
var n = ({ className: n, ...r }) => /* @__PURE__ */ t("input", {
|
|
5
|
+
type: "radio",
|
|
6
|
+
className: [e.radio, n].filter(Boolean).join(" "),
|
|
7
|
+
...r
|
|
8
|
+
});
|
|
11
9
|
//#endregion
|
|
12
10
|
export { n as RadioButton };
|
|
13
11
|
|