@dxos/react-ui 0.1.41-next.adfd7c6 → 0.3.3-main.3ce60d4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/README.yml +1 -0
- package/dist/lib/browser/index.mjs +2096 -2849
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +51 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -0
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +27 -0
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts +21 -0
- package/dist/types/src/components/Avatars/AvatarGroup.d.ts.map +1 -0
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +9 -0
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Avatars/index.d.ts +3 -0
- package/dist/types/src/components/Avatars/index.d.ts.map +1 -0
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +29 -0
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +9 -0
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -0
- package/dist/types/src/components/Breadcrumb/index.d.ts +2 -0
- package/dist/types/src/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/Button.d.ts +24 -0
- package/dist/types/src/components/Buttons/Button.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/Button.stories.d.ts +37 -0
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/Toggle.d.ts +8 -0
- package/dist/types/src/components/Buttons/Toggle.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +10 -0
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +28 -0
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +15 -0
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Buttons/index.d.ts +4 -0
- package/dist/types/src/components/Buttons/index.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.d.ts +44 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.stories.d.ts +49 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Card/index.d.ts +2 -0
- package/dist/types/src/components/Card/index.d.ts.map +1 -0
- package/dist/types/src/components/Card/testing.d.ts +9 -0
- package/dist/types/src/components/Card/testing.d.ts.map +1 -0
- package/dist/types/src/components/Center/Center.d.ts +4 -0
- package/dist/types/src/components/Center/Center.d.ts.map +1 -0
- package/dist/types/src/components/Center/Center.stories.d.ts +11 -0
- package/dist/types/src/components/Center/Center.stories.d.ts.map +1 -0
- package/dist/types/src/components/Center/index.d.ts +2 -0
- package/dist/types/src/components/Center/index.d.ts.map +1 -0
- package/dist/types/src/components/ComboBox/ComboBox.d.ts +49 -0
- package/dist/types/src/components/ComboBox/ComboBox.d.ts.map +1 -0
- package/dist/types/src/components/ComboBox/ComboBox.stories.d.ts +25 -0
- package/dist/types/src/components/ComboBox/ComboBox.stories.d.ts.map +1 -0
- package/dist/types/src/components/ComboBox/index.d.ts +2 -0
- package/dist/types/src/components/ComboBox/index.d.ts.map +1 -0
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +11 -0
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -0
- package/dist/types/src/components/DensityProvider/index.d.ts +2 -0
- package/dist/types/src/components/DensityProvider/index.d.ts.map +1 -0
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +29 -0
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +23 -0
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialogs/Dialog.d.ts +27 -0
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +21 -0
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialogs/index.d.ts +3 -0
- package/dist/types/src/components/Dialogs/index.d.ts.map +1 -0
- package/dist/types/src/components/DropdownMenu/DropdownMenu.d.ts +44 -0
- package/dist/types/src/components/DropdownMenu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts +14 -0
- package/dist/types/src/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/DropdownMenu/index.d.ts +2 -0
- package/dist/types/src/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +11 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/index.d.ts +2 -0
- package/dist/types/src/components/ElevationProvider/index.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +55 -0
- package/dist/types/src/components/Input/Input.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.stories.d.ts +151 -0
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -0
- package/dist/types/src/components/Input/index.d.ts +2 -0
- package/dist/types/src/components/Input/index.d.ts.map +1 -0
- package/dist/types/src/components/Link/Link.d.ts +8 -0
- package/dist/types/src/components/Link/Link.d.ts.map +1 -0
- package/dist/types/src/components/Link/Link.stories.d.ts +10 -0
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -0
- package/dist/types/src/components/Link/index.d.ts +2 -0
- package/dist/types/src/components/Link/index.d.ts.map +1 -0
- package/dist/types/src/components/List/List.d.ts +25 -0
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/List/List.stories.d.ts +29 -0
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.d.ts +21 -0
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.stories.d.ts +29 -0
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts +3 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.d.ts +57 -0
- package/dist/types/src/components/Main/Main.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.stories.d.ts +11 -0
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -0
- package/dist/types/src/components/Main/index.d.ts +2 -0
- package/dist/types/src/components/Main/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts +11 -0
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.d.ts +23 -0
- package/dist/types/src/components/Message/Message.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.stories.d.ts +19 -0
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -0
- package/dist/types/src/components/Message/index.d.ts +2 -0
- package/dist/types/src/components/Message/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts +32 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.stories.d.ts +15 -0
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -0
- package/dist/types/src/components/Popover/index.d.ts +2 -0
- package/dist/types/src/components/Popover/index.d.ts.map +1 -0
- package/dist/types/src/components/ProgressBar/ProgressBar.d.ts +7 -0
- package/dist/types/src/components/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts +12 -0
- package/dist/types/src/components/ProgressBar/ProgressBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProgressBar/index.d.ts +2 -0
- package/dist/types/src/components/ProgressBar/index.d.ts.map +1 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +27 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +14 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScrollArea/index.d.ts +2 -0
- package/dist/types/src/components/ScrollArea/index.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.d.ts +60 -0
- package/dist/types/src/components/Select/Select.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.stories.d.ts +16 -0
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -0
- package/dist/types/src/components/Select/index.d.ts +2 -0
- package/dist/types/src/components/Select/index.d.ts.map +1 -0
- package/dist/types/src/components/Separator/Separator.d.ts +7 -0
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -0
- package/dist/types/src/components/Separator/index.d.ts +2 -0
- package/dist/types/src/components/Separator/index.d.ts.map +1 -0
- package/dist/types/src/components/Tag/Tag.d.ts +10 -0
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -0
- package/dist/types/src/components/Tag/Tag.stories.d.ts +10 -0
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -0
- package/dist/types/src/components/Tag/index.d.ts +2 -0
- package/dist/types/src/components/Tag/index.d.ts.map +1 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +16 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -0
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +20 -0
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -0
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -0
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -0
- package/dist/types/src/components/Toast/Toast.d.ts +34 -0
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -0
- package/dist/types/src/components/Toast/Toast.stories.d.ts +34 -0
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toast/index.d.ts +2 -0
- package/dist/types/src/components/Toast/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +42 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +10 -0
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +23 -0
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +19 -0
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -0
- package/dist/types/src/components/Tooltip/index.d.ts +2 -0
- package/dist/types/src/components/Tooltip/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +25 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +6 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useDensityContext.d.ts +3 -0
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useElevationContext.d.ts +3 -0
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useThemeContext.d.ts +2 -0
- package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useTranslationsContext.d.ts +4 -0
- package/dist/types/src/hooks/useTranslationsContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useVisualViewport.d.ts +6 -0
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +6 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +11 -0
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -0
- package/dist/types/src/playground/Surfaces.stories.d.ts +9 -0
- package/dist/types/src/playground/Surfaces.stories.d.ts.map +1 -0
- package/dist/types/src/playground/helpers.d.ts +6 -0
- package/dist/types/src/playground/helpers.d.ts.map +1 -0
- package/dist/types/src/util/ThemedClassName.d.ts +5 -0
- package/dist/types/src/util/ThemedClassName.d.ts.map +1 -0
- package/dist/types/src/util/hasIosKeyboard.d.ts +2 -0
- package/dist/types/src/util/hasIosKeyboard.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/package.json +43 -41
- package/src/components/Avatars/Avatar.stories.tsx +104 -0
- package/src/components/Avatars/Avatar.tsx +303 -0
- package/src/components/Avatars/AvatarGroup.stories.tsx +49 -0
- package/src/components/Avatars/AvatarGroup.tsx +111 -0
- package/src/components/Avatars/index.ts +6 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +46 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +116 -0
- package/src/{composites/JoinDialog → components/Breadcrumb}/index.ts +1 -1
- package/src/components/Buttons/Button.stories.tsx +85 -0
- package/src/components/Buttons/Button.tsx +93 -0
- package/src/components/Buttons/Toggle.stories.tsx +28 -0
- package/src/components/Buttons/Toggle.tsx +23 -0
- package/src/components/Buttons/ToggleGroup.stories.tsx +38 -0
- package/src/components/Buttons/ToggleGroup.tsx +41 -0
- package/src/components/Buttons/index.ts +7 -0
- package/src/components/Card/Card.stories.tsx +215 -0
- package/src/components/Card/Card.tsx +114 -0
- package/src/{panels/SpacePanel → components/Card}/index.ts +1 -1
- package/src/components/Card/testing.ts +90 -0
- package/src/components/Center/Center.stories.tsx +18 -0
- package/src/components/Center/Center.tsx +16 -0
- package/src/{layouts/PanelDialog → components/Center}/index.ts +1 -1
- package/src/components/ComboBox/ComboBox.stories.tsx +82 -0
- package/src/components/ComboBox/ComboBox.tsx +218 -0
- package/src/components/ComboBox/index.ts +5 -0
- package/src/components/DensityProvider/DensityProvider.tsx +21 -0
- package/src/components/DensityProvider/index.ts +5 -0
- package/src/components/Dialogs/AlertDialog.stories.tsx +68 -0
- package/src/components/Dialogs/AlertDialog.tsx +157 -0
- package/src/components/Dialogs/Dialog.stories.tsx +52 -0
- package/src/components/Dialogs/Dialog.tsx +143 -0
- package/src/components/Dialogs/index.ts +6 -0
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +102 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +171 -0
- package/src/{layouts/PanelPopover → components/DropdownMenu}/index.ts +1 -1
- package/src/components/ElevationProvider/ElevationProvider.tsx +21 -0
- package/src/components/ElevationProvider/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +199 -0
- package/src/components/Input/Input.tsx +369 -0
- package/src/{composites/SpaceDialog → components/Input}/index.ts +1 -1
- package/src/components/Link/Link.stories.tsx +13 -0
- package/src/components/Link/Link.tsx +20 -0
- package/src/components/Link/index.ts +5 -0
- package/src/components/List/List.stories.tsx +184 -0
- package/src/components/List/List.tsx +173 -0
- package/src/components/List/Tree.stories.tsx +80 -0
- package/src/components/List/Tree.tsx +76 -0
- package/src/components/List/index.ts +6 -0
- package/src/components/Main/Main.stories.tsx +52 -0
- package/src/components/Main/Main.tsx +271 -0
- package/src/components/Main/index.ts +5 -0
- package/src/components/Main/useSwipeToDismiss.ts +103 -0
- package/src/components/Message/Message.stories.tsx +39 -0
- package/src/components/Message/Message.tsx +109 -0
- package/src/components/Message/index.ts +5 -0
- package/src/components/Popover/Popover.stories.tsx +38 -0
- package/src/components/Popover/Popover.tsx +123 -0
- package/src/components/Popover/index.ts +5 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +33 -0
- package/src/components/ProgressBar/ProgressBar.tsx +29 -0
- package/src/components/ProgressBar/index.ts +5 -0
- package/src/components/ScrollArea/ScrollArea.stories.tsx +43 -0
- package/src/components/ScrollArea/ScrollArea.tsx +105 -0
- package/src/components/ScrollArea/index.ts +5 -0
- package/src/components/Select/Select.stories.tsx +68 -0
- package/src/components/Select/Select.tsx +223 -0
- package/src/components/Select/index.ts +5 -0
- package/src/components/Separator/Separator.tsx +28 -0
- package/src/components/Separator/index.ts +5 -0
- package/src/components/Tag/Tag.stories.tsx +42 -0
- package/src/components/Tag/Tag.tsx +23 -0
- package/src/components/Tag/index.ts +5 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +76 -0
- package/src/components/ThemeProvider/TranslationsProvider.tsx +63 -0
- package/src/components/ThemeProvider/index.ts +5 -0
- package/src/components/Toast/Toast.stories.tsx +61 -0
- package/src/components/Toast/Toast.tsx +126 -0
- package/src/components/Toast/index.ts +5 -0
- package/src/components/Toolbar/Toolbar.stories.tsx +77 -0
- package/src/components/Toolbar/Toolbar.tsx +99 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +41 -0
- package/src/components/Tooltip/Tooltip.tsx +84 -0
- package/src/components/Tooltip/index.ts +5 -0
- package/src/components/index.ts +27 -7
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useDensityContext.ts +14 -0
- package/src/hooks/useElevationContext.ts +14 -0
- package/src/hooks/useThemeContext.ts +9 -0
- package/src/hooks/useTranslationsContext.ts +9 -0
- package/src/hooks/useVisualViewport.ts +24 -0
- package/src/index.ts +8 -6
- package/src/playground/Controls.stories.tsx +90 -0
- package/src/playground/Surfaces.stories.tsx +43 -0
- package/src/playground/helpers.tsx +32 -0
- package/src/util/ThemedClassName.ts +7 -0
- package/src/util/hasIosKeyboard.ts +8 -0
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-5VRACIDE.mjs +0 -10
- package/dist/lib/browser/chunk-5VRACIDE.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -64
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +0 -9
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +0 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +0 -5
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +0 -1
- package/dist/types/src/components/Clipboard/index.d.ts +0 -3
- package/dist/types/src/components/Clipboard/index.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +0 -7
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts +0 -21
- package/dist/types/src/components/IdentityList/IdentityListItem.stories.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +0 -7
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts +0 -9
- package/dist/types/src/components/IdentityList/SpaceMemberListContainer.d.ts.map +0 -1
- package/dist/types/src/components/IdentityList/index.d.ts +0 -5
- package/dist/types/src/components/IdentityList/index.d.ts.map +0 -1
- package/dist/types/src/components/InvitationEmoji/InvitationEmoji.d.ts +0 -7
- package/dist/types/src/components/InvitationEmoji/InvitationEmoji.d.ts.map +0 -1
- package/dist/types/src/components/InvitationEmoji/index.d.ts +0 -2
- package/dist/types/src/components/InvitationEmoji/index.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationList.d.ts +0 -7
- package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +0 -10
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +0 -7
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +0 -9
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +0 -4
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts +0 -15
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts +0 -9
- package/dist/types/src/components/InvitationList/InvitationStatusAvatar.stories.d.ts.map +0 -1
- package/dist/types/src/components/InvitationList/index.d.ts +0 -5
- package/dist/types/src/components/InvitationList/index.d.ts.map +0 -1
- package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts +0 -3
- package/dist/types/src/components/PanelSeparator/PanelSeparator.d.ts.map +0 -1
- package/dist/types/src/components/PanelSeparator/index.d.ts +0 -2
- package/dist/types/src/components/PanelSeparator/index.d.ts.map +0 -1
- package/dist/types/src/components/SpaceList/SpaceListItem.d.ts +0 -7
- package/dist/types/src/components/SpaceList/SpaceListItem.d.ts.map +0 -1
- package/dist/types/src/components/SpaceList/index.d.ts +0 -2
- package/dist/types/src/components/SpaceList/index.d.ts.map +0 -1
- package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts +0 -6
- package/dist/types/src/composites/DevicesDialog/DevicesDialog.d.ts.map +0 -1
- package/dist/types/src/composites/DevicesDialog/index.d.ts +0 -2
- package/dist/types/src/composites/DevicesDialog/index.d.ts.map +0 -1
- package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts +0 -9
- package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts.map +0 -1
- package/dist/types/src/composites/IdentityPopover/index.d.ts +0 -2
- package/dist/types/src/composites/IdentityPopover/index.d.ts.map +0 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +0 -6
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +0 -1
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts +0 -10
- package/dist/types/src/composites/JoinDialog/JoinDialog.stories.d.ts.map +0 -1
- package/dist/types/src/composites/JoinDialog/index.d.ts +0 -2
- package/dist/types/src/composites/JoinDialog/index.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/Shell.d.ts +0 -6
- package/dist/types/src/composites/Shell/Shell.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/Shell.stories.d.ts +0 -10
- package/dist/types/src/composites/Shell/Shell.stories.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/ShellContext.d.ts +0 -22
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +0 -1
- package/dist/types/src/composites/Shell/index.d.ts +0 -3
- package/dist/types/src/composites/Shell/index.d.ts.map +0 -1
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +0 -6
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +0 -1
- package/dist/types/src/composites/SpaceDialog/index.d.ts +0 -2
- package/dist/types/src/composites/SpaceDialog/index.d.ts.map +0 -1
- package/dist/types/src/composites/index.d.ts +0 -5
- package/dist/types/src/composites/index.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts +0 -14
- package/dist/types/src/layouts/PanelAlertDialog/PanelAlertDialog.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelAlertDialog/index.d.ts +0 -2
- package/dist/types/src/layouts/PanelAlertDialog/index.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts +0 -14
- package/dist/types/src/layouts/PanelDialog/PanelDialog.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelDialog/index.d.ts +0 -2
- package/dist/types/src/layouts/PanelDialog/index.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts +0 -11
- package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelPopover/index.d.ts +0 -2
- package/dist/types/src/layouts/PanelPopover/index.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts +0 -19
- package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts.map +0 -1
- package/dist/types/src/layouts/PanelSidebar/index.d.ts +0 -2
- package/dist/types/src/layouts/PanelSidebar/index.d.ts.map +0 -1
- package/dist/types/src/layouts/index.d.ts +0 -5
- package/dist/types/src/layouts/index.d.ts.map +0 -1
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts +0 -10
- package/dist/types/src/panels/DevicesPanel/DevicesPanel.d.ts.map +0 -1
- package/dist/types/src/panels/DevicesPanel/index.d.ts +0 -2
- package/dist/types/src/panels/DevicesPanel/index.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +0 -6
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +0 -1
- package/dist/types/src/panels/IdentityPanel/index.d.ts +0 -2
- package/dist/types/src/panels/IdentityPanel/index.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +0 -13
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +0 -3
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +0 -54
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/index.d.ts +0 -3
- package/dist/types/src/panels/JoinPanel/index.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +0 -64
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts +0 -4
- package/dist/types/src/panels/JoinPanel/view-states/AdditionMethodSelector.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts +0 -15
- package/dist/types/src/panels/JoinPanel/view-states/IdentityAdded.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts +0 -6
- package/dist/types/src/panels/JoinPanel/view-states/IdentityInput.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts +0 -10
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAccepted.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts +0 -7
- package/dist/types/src/panels/JoinPanel/view-states/InvitationAuthenticator.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts +0 -6
- package/dist/types/src/panels/JoinPanel/view-states/InvitationInput.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts +0 -6
- package/dist/types/src/panels/JoinPanel/view-states/InvitationRescuer.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts +0 -10
- package/dist/types/src/panels/JoinPanel/view-states/ViewState.d.ts.map +0 -1
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts +0 -8
- package/dist/types/src/panels/JoinPanel/view-states/index.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +0 -12
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +0 -8
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +0 -1
- package/dist/types/src/panels/SpacePanel/index.d.ts +0 -2
- package/dist/types/src/panels/SpacePanel/index.d.ts.map +0 -1
- package/dist/types/src/panels/index.d.ts +0 -5
- package/dist/types/src/panels/index.d.ts.map +0 -1
- package/dist/types/src/playwright/invitations-manager.d.ts +0 -25
- package/dist/types/src/playwright/invitations-manager.d.ts.map +0 -1
- package/dist/types/src/playwright/invitations.spec.d.ts +0 -2
- package/dist/types/src/playwright/invitations.spec.d.ts.map +0 -1
- package/dist/types/src/playwright/playwright.config.d.ts +0 -3
- package/dist/types/src/playwright/playwright.config.d.ts.map +0 -1
- package/dist/types/src/stories/Invitations.stories.d.ts +0 -14
- package/dist/types/src/stories/Invitations.stories.d.ts.map +0 -1
- package/dist/types/src/styles/dialogStyles.d.ts +0 -3
- package/dist/types/src/styles/dialogStyles.d.ts.map +0 -1
- package/dist/types/src/styles/index.d.ts +0 -4
- package/dist/types/src/styles/index.d.ts.map +0 -1
- package/dist/types/src/styles/invitationStatusStyles.d.ts +0 -20
- package/dist/types/src/styles/invitationStatusStyles.d.ts.map +0 -1
- package/dist/types/src/styles/panelStyles.d.ts +0 -4
- package/dist/types/src/styles/panelStyles.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/shell-manager.d.ts +0 -17
- package/dist/types/src/testing/shell-manager.d.ts.map +0 -1
- package/dist/types/src/translations/index.d.ts +0 -5
- package/dist/types/src/translations/index.d.ts.map +0 -1
- package/dist/types/src/translations/locales/en-US.d.ts +0 -66
- package/dist/types/src/translations/locales/en-US.d.ts.map +0 -1
- package/dist/types/src/util/invitationStatusValue.d.ts +0 -8
- package/dist/types/src/util/invitationStatusValue.d.ts.map +0 -1
- package/dist/types/src/util/toEmoji.d.ts +0 -2
- package/dist/types/src/util/toEmoji.d.ts.map +0 -1
- package/src/components/Clipboard/ClipboardProvider.tsx +0 -26
- package/src/components/Clipboard/CopyButton.tsx +0 -38
- package/src/components/Clipboard/index.ts +0 -6
- package/src/components/IdentityList/DeviceList.tsx +0 -31
- package/src/components/IdentityList/IdentityListItem.stories.tsx +0 -23
- package/src/components/IdentityList/IdentityListItem.tsx +0 -48
- package/src/components/IdentityList/SpaceMemberList.tsx +0 -33
- package/src/components/IdentityList/SpaceMemberListContainer.tsx +0 -32
- package/src/components/IdentityList/index.ts +0 -8
- package/src/components/InvitationEmoji/InvitationEmoji.tsx +0 -32
- package/src/components/InvitationEmoji/index.ts +0 -5
- package/src/components/InvitationList/InvitationList.stories.tsx +0 -65
- package/src/components/InvitationList/InvitationList.tsx +0 -33
- package/src/components/InvitationList/InvitationListContainer.tsx +0 -27
- package/src/components/InvitationList/InvitationListItem.tsx +0 -91
- package/src/components/InvitationList/InvitationListProps.ts +0 -7
- package/src/components/InvitationList/InvitationStatusAvatar.stories.tsx +0 -52
- package/src/components/InvitationList/InvitationStatusAvatar.tsx +0 -91
- package/src/components/InvitationList/index.ts +0 -8
- package/src/components/PanelSeparator/PanelSeparator.tsx +0 -17
- package/src/components/PanelSeparator/index.ts +0 -5
- package/src/components/SpaceList/SpaceListItem.tsx +0 -32
- package/src/components/SpaceList/index.ts +0 -5
- package/src/composites/DevicesDialog/DevicesDialog.tsx +0 -39
- package/src/composites/DevicesDialog/index.ts +0 -5
- package/src/composites/IdentityPopover/IdentityPopover.tsx +0 -54
- package/src/composites/IdentityPopover/index.ts +0 -5
- package/src/composites/JoinDialog/JoinDialog.stories.tsx +0 -74
- package/src/composites/JoinDialog/JoinDialog.tsx +0 -35
- package/src/composites/Shell/Shell.stories.tsx +0 -93
- package/src/composites/Shell/Shell.tsx +0 -100
- package/src/composites/Shell/ShellContext.tsx +0 -178
- package/src/composites/Shell/index.ts +0 -6
- package/src/composites/SpaceDialog/SpaceDialog.tsx +0 -39
- package/src/composites/index.ts +0 -8
- package/src/layouts/PanelAlertDialog/PanelAlertDialog.tsx +0 -40
- package/src/layouts/PanelAlertDialog/index.ts +0 -5
- package/src/layouts/PanelDialog/PanelDialog.tsx +0 -41
- package/src/layouts/PanelPopover/PanelPopover.tsx +0 -40
- package/src/layouts/PanelSidebar/PanelSidebar.tsx +0 -124
- package/src/layouts/PanelSidebar/index.ts +0 -5
- package/src/layouts/index.ts +0 -8
- package/src/panels/DevicesPanel/DevicesPanel.tsx +0 -113
- package/src/panels/DevicesPanel/index.ts +0 -5
- package/src/panels/IdentityPanel/IdentityPanel.tsx +0 -43
- package/src/panels/IdentityPanel/index.ts +0 -5
- package/src/panels/JoinPanel/JoinHeading.tsx +0 -73
- package/src/panels/JoinPanel/JoinPanel.tsx +0 -247
- package/src/panels/JoinPanel/JoinPanelProps.ts +0 -90
- package/src/panels/JoinPanel/index.ts +0 -6
- package/src/panels/JoinPanel/joinMachine.ts +0 -444
- package/src/panels/JoinPanel/view-states/AdditionMethodSelector.tsx +0 -63
- package/src/panels/JoinPanel/view-states/IdentityAdded.tsx +0 -99
- package/src/panels/JoinPanel/view-states/IdentityInput.tsx +0 -81
- package/src/panels/JoinPanel/view-states/InvitationAccepted.tsx +0 -74
- package/src/panels/JoinPanel/view-states/InvitationAuthenticator.tsx +0 -152
- package/src/panels/JoinPanel/view-states/InvitationInput.tsx +0 -75
- package/src/panels/JoinPanel/view-states/InvitationRescuer.tsx +0 -115
- package/src/panels/JoinPanel/view-states/ViewState.tsx +0 -153
- package/src/panels/JoinPanel/view-states/index.ts +0 -11
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +0 -15
- package/src/panels/SpacePanel/SpacePanel.tsx +0 -105
- package/src/panels/index.ts +0 -8
- package/src/playwright/invitations-manager.ts +0 -165
- package/src/playwright/invitations.spec.ts +0 -393
- package/src/playwright/playwright.config.ts +0 -7
- package/src/stories/Invitations.stories.tsx +0 -187
- package/src/styles/dialogStyles.ts +0 -8
- package/src/styles/index.ts +0 -7
- package/src/styles/invitationStatusStyles.ts +0 -42
- package/src/styles/panelStyles.ts +0 -7
- package/src/testing/index.ts +0 -5
- package/src/testing/shell-manager.ts +0 -79
- package/src/translations/index.ts +0 -7
- package/src/translations/locales/en-US.ts +0 -69
- package/src/util/invitationStatusValue.ts +0 -22
- package/src/util/toEmoji.ts +0 -22
- package/theme-extensions.js +0 -11
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { CaretDown, CaretUp } from '@phosphor-icons/react';
|
|
6
|
+
import { createContextScope, type Scope } from '@radix-ui/react-context';
|
|
7
|
+
import { createPopperScope } from '@radix-ui/react-popper';
|
|
8
|
+
import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
9
|
+
import { useCombobox, type UseComboboxReturnValue } from 'downshift';
|
|
10
|
+
import React, { forwardRef, type PropsWithChildren } from 'react';
|
|
11
|
+
|
|
12
|
+
import { useThemeContext } from '../../hooks';
|
|
13
|
+
import { type ThemedClassName } from '../../util';
|
|
14
|
+
import { Button } from '../Buttons';
|
|
15
|
+
import { Input } from '../Input';
|
|
16
|
+
|
|
17
|
+
const COMBOBOX_NAME = 'ComboBox';
|
|
18
|
+
|
|
19
|
+
type ScopedProps<P> = P & { __scopeComboBox?: Scope };
|
|
20
|
+
|
|
21
|
+
type ComboBoxItem = {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
data?: any;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type ComboBoxContextValue = {
|
|
28
|
+
items: ComboBoxItem[];
|
|
29
|
+
} & UseComboboxReturnValue<ComboBoxItem>;
|
|
30
|
+
|
|
31
|
+
const usePopperScope = createPopperScope();
|
|
32
|
+
const [createComboBoxContext] = createContextScope(COMBOBOX_NAME, [createPopperScope]);
|
|
33
|
+
const [ComboBoxProvider, useComboBoxContext] = createComboBoxContext<ComboBoxContextValue>(COMBOBOX_NAME);
|
|
34
|
+
|
|
35
|
+
type ComboBoxRootProps = ThemedClassName<
|
|
36
|
+
ScopedProps<
|
|
37
|
+
PropsWithChildren<{
|
|
38
|
+
items?: ComboBoxItem[];
|
|
39
|
+
value?: ComboBoxItem;
|
|
40
|
+
onChange?: (selected: ComboBoxItem | undefined) => void;
|
|
41
|
+
onInputChange?: (text?: string) => void;
|
|
42
|
+
}>
|
|
43
|
+
>
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Type-ahead combobox.
|
|
48
|
+
*/
|
|
49
|
+
const ComboBoxRoot = ({
|
|
50
|
+
__scopeComboBox,
|
|
51
|
+
children,
|
|
52
|
+
classNames,
|
|
53
|
+
items = [],
|
|
54
|
+
value,
|
|
55
|
+
onChange,
|
|
56
|
+
onInputChange,
|
|
57
|
+
}: ComboBoxRootProps) => {
|
|
58
|
+
const { tx } = useThemeContext();
|
|
59
|
+
const popperScope = usePopperScope(__scopeComboBox);
|
|
60
|
+
|
|
61
|
+
// TODO(burdon): Remove and implement natively?
|
|
62
|
+
// https://www.downshift-js.com/use-combobox
|
|
63
|
+
const comboProps = useCombobox<ComboBoxItem>({
|
|
64
|
+
items,
|
|
65
|
+
itemToString: (selectedItem) => selectedItem?.label ?? '',
|
|
66
|
+
onInputValueChange: ({ inputValue }) => onInputChange?.(inputValue),
|
|
67
|
+
selectedItem: value ?? null,
|
|
68
|
+
onSelectedItemChange: ({ selectedItem }) => onChange?.(selectedItem === null ? undefined : selectedItem),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<ComboBoxProvider scope={__scopeComboBox} items={items} {...comboProps}>
|
|
73
|
+
<PopperPrimitive.Root {...popperScope}>
|
|
74
|
+
<div className={tx('combobox.root', 'combobox__root', {}, classNames)}>{children}</div>
|
|
75
|
+
</PopperPrimitive.Root>
|
|
76
|
+
</ComboBoxProvider>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//
|
|
81
|
+
// Input
|
|
82
|
+
//
|
|
83
|
+
|
|
84
|
+
const INPUT_NAME = 'ComboBoxInput';
|
|
85
|
+
|
|
86
|
+
type ComboBoxInputProps = ThemedClassName<
|
|
87
|
+
ScopedProps<
|
|
88
|
+
PropsWithChildren<{
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
}>
|
|
91
|
+
>
|
|
92
|
+
>;
|
|
93
|
+
|
|
94
|
+
const ComboBoxInput = forwardRef<HTMLDivElement, ComboBoxInputProps>(
|
|
95
|
+
({ __scopeComboBox, classNames, placeholder }: ComboBoxInputProps, forwardedRef) => {
|
|
96
|
+
const { tx } = useThemeContext();
|
|
97
|
+
const popperScope = usePopperScope(__scopeComboBox);
|
|
98
|
+
const { getInputProps, getToggleButtonProps, isOpen } = useComboBoxContext(INPUT_NAME, __scopeComboBox);
|
|
99
|
+
|
|
100
|
+
// TODO(burdon): Break out input and button.
|
|
101
|
+
return (
|
|
102
|
+
<PopperPrimitive.Anchor asChild {...popperScope} ref={forwardedRef}>
|
|
103
|
+
{/* TODO(burdon): Move class to theme. */}
|
|
104
|
+
<div role='none' className='flex items-center gap-1'>
|
|
105
|
+
<Input.Root>
|
|
106
|
+
<Input.TextInput
|
|
107
|
+
{...getInputProps()}
|
|
108
|
+
placeholder={placeholder}
|
|
109
|
+
variant='subdued'
|
|
110
|
+
classNames={tx('combobox.input', 'combobox__input', {}, classNames)}
|
|
111
|
+
/>
|
|
112
|
+
</Input.Root>
|
|
113
|
+
<Button
|
|
114
|
+
{...getToggleButtonProps()}
|
|
115
|
+
aria-label='toggle menu'
|
|
116
|
+
variant='ghost'
|
|
117
|
+
classNames={tx('combobox.button', 'combobox__button')}
|
|
118
|
+
>
|
|
119
|
+
{(isOpen && <CaretUp />) || <CaretDown />}
|
|
120
|
+
</Button>
|
|
121
|
+
</div>
|
|
122
|
+
</PopperPrimitive.Anchor>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
//
|
|
128
|
+
// Content
|
|
129
|
+
//
|
|
130
|
+
|
|
131
|
+
const CONTENT_NAME = 'ComboBoxContent';
|
|
132
|
+
|
|
133
|
+
type ComboBoxContentProps = ThemedClassName<ScopedProps<PropsWithChildren<{}>>>;
|
|
134
|
+
|
|
135
|
+
const ComboBoxContent = forwardRef<HTMLDivElement, ComboBoxContentProps>(
|
|
136
|
+
({ __scopeComboBox, classNames, children }: ComboBoxContentProps, forwardedRef) => {
|
|
137
|
+
const { tx } = useThemeContext();
|
|
138
|
+
const popperScope = usePopperScope(__scopeComboBox);
|
|
139
|
+
const { getMenuProps, isOpen } = useComboBoxContext(CONTENT_NAME, __scopeComboBox);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<PopperPrimitive.Content
|
|
143
|
+
data-state={isOpen}
|
|
144
|
+
role='dialog'
|
|
145
|
+
{...popperScope}
|
|
146
|
+
ref={forwardedRef}
|
|
147
|
+
style={
|
|
148
|
+
{
|
|
149
|
+
// Re-namespace exposed content custom properties.
|
|
150
|
+
...{
|
|
151
|
+
'--radix-combobox-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
152
|
+
'--radix-combobox-content-available-width': 'var(--radix-popper-available-width)',
|
|
153
|
+
'--radix-combobox-content-available-height': 'var(--radix-popper-available-height)',
|
|
154
|
+
'--radix-combobox-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
155
|
+
'--radix-combobox-trigger-height': 'var(--radix-popper-anchor-height)',
|
|
156
|
+
},
|
|
157
|
+
} as any // TODO(burdon): Why any?
|
|
158
|
+
}
|
|
159
|
+
>
|
|
160
|
+
<ul {...getMenuProps()} className={tx('combobox.content', 'combobox__content', {}, classNames)}>
|
|
161
|
+
{isOpen && children}
|
|
162
|
+
</ul>
|
|
163
|
+
</PopperPrimitive.Content>
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
//
|
|
169
|
+
// Item
|
|
170
|
+
//
|
|
171
|
+
|
|
172
|
+
const ITEM_NAME = 'ComboBoxItem';
|
|
173
|
+
|
|
174
|
+
type ComboBoxItemProps = ThemedClassName<
|
|
175
|
+
ScopedProps<
|
|
176
|
+
PropsWithChildren<{
|
|
177
|
+
item: ComboBoxItem;
|
|
178
|
+
}>
|
|
179
|
+
>
|
|
180
|
+
>;
|
|
181
|
+
|
|
182
|
+
const ComboBoxItem = forwardRef<HTMLLIElement, ComboBoxItemProps>(
|
|
183
|
+
({ __scopeComboBox, classNames, children, item }, forwardedRef) => {
|
|
184
|
+
const { tx } = useThemeContext();
|
|
185
|
+
const { getItemProps, items, selectedItem, highlightedIndex } = useComboBoxContext(ITEM_NAME, __scopeComboBox);
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<li
|
|
189
|
+
ref={forwardedRef}
|
|
190
|
+
data-selected={selectedItem?.id === item.id ? 'true' : undefined}
|
|
191
|
+
data-highlighted={
|
|
192
|
+
highlightedIndex !== undefined && items[highlightedIndex]?.id === item.id ? 'true' : undefined
|
|
193
|
+
}
|
|
194
|
+
className={tx('combobox.item', 'item', {}, classNames)}
|
|
195
|
+
{...getItemProps({ item })}
|
|
196
|
+
>
|
|
197
|
+
{children}
|
|
198
|
+
</li>
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// prettier-ignore
|
|
204
|
+
export const ComboBox = {
|
|
205
|
+
Root: ComboBoxRoot,
|
|
206
|
+
Input: ComboBoxInput,
|
|
207
|
+
Content: ComboBoxContent,
|
|
208
|
+
Item: ComboBoxItem
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// prettier-ignore
|
|
212
|
+
export type {
|
|
213
|
+
ComboBoxItem,
|
|
214
|
+
ComboBoxRootProps,
|
|
215
|
+
ComboBoxInputProps,
|
|
216
|
+
ComboBoxContentProps,
|
|
217
|
+
ComboBoxItemProps
|
|
218
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { createContext, type PropsWithChildren } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Density } from '@dxos/react-ui-types';
|
|
8
|
+
|
|
9
|
+
export interface DensityContextValue {
|
|
10
|
+
density?: Density;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type DensityProviderProps = PropsWithChildren<{
|
|
14
|
+
density?: Density;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export const DensityContext = createContext<DensityContextValue>({ density: 'coarse' });
|
|
18
|
+
|
|
19
|
+
export const DensityProvider = ({ density, children }: DensityProviderProps) => (
|
|
20
|
+
<DensityContext.Provider value={{ density }}>{children}</DensityContext.Provider>
|
|
21
|
+
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxosTheme';
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { AlertDialog } from './AlertDialog';
|
|
10
|
+
import { Button } from '../Buttons';
|
|
11
|
+
import { Toolbar } from '../Toolbar';
|
|
12
|
+
|
|
13
|
+
type StorybookAlertDialogProps = Partial<{
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
body: string;
|
|
17
|
+
cancelTrigger: string; // TODO(burdon): Why trigger?
|
|
18
|
+
actionTrigger: string;
|
|
19
|
+
openTrigger: string;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
const StorybookAlertDialog = ({
|
|
23
|
+
title,
|
|
24
|
+
openTrigger,
|
|
25
|
+
description,
|
|
26
|
+
body,
|
|
27
|
+
cancelTrigger,
|
|
28
|
+
actionTrigger,
|
|
29
|
+
}: StorybookAlertDialogProps) => {
|
|
30
|
+
return (
|
|
31
|
+
<AlertDialog.Root defaultOpen>
|
|
32
|
+
<AlertDialog.Trigger asChild>
|
|
33
|
+
<Button>{openTrigger}</Button>
|
|
34
|
+
</AlertDialog.Trigger>
|
|
35
|
+
<AlertDialog.Overlay>
|
|
36
|
+
<AlertDialog.Content>
|
|
37
|
+
<AlertDialog.Title>{title}</AlertDialog.Title>
|
|
38
|
+
<AlertDialog.Description>{description}</AlertDialog.Description>
|
|
39
|
+
<p className='mbs-2 mbe-8'>{body}</p>
|
|
40
|
+
<Toolbar.Root>
|
|
41
|
+
<div className='grow' />
|
|
42
|
+
<AlertDialog.Cancel asChild>
|
|
43
|
+
<Toolbar.Button>{cancelTrigger}</Toolbar.Button>
|
|
44
|
+
</AlertDialog.Cancel>
|
|
45
|
+
<AlertDialog.Action asChild>
|
|
46
|
+
<Toolbar.Button variant='primary'>{actionTrigger}</Toolbar.Button>
|
|
47
|
+
</AlertDialog.Action>
|
|
48
|
+
</Toolbar.Root>
|
|
49
|
+
</AlertDialog.Content>
|
|
50
|
+
</AlertDialog.Overlay>
|
|
51
|
+
</AlertDialog.Root>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
component: StorybookAlertDialog,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Default = {
|
|
60
|
+
args: {
|
|
61
|
+
title: 'AlertDialog title',
|
|
62
|
+
openTrigger: 'Open AlertDialog',
|
|
63
|
+
description: 'AlertDialog description',
|
|
64
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
65
|
+
cancelTrigger: 'Cancel',
|
|
66
|
+
actionTrigger: 'Action',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type AlertDialogProps as AlertDialogRootPrimitiveProps,
|
|
7
|
+
Root as AlertDialogRootPrimitive,
|
|
8
|
+
AlertDialogTrigger as AlertDialogTriggerPrimitive,
|
|
9
|
+
type AlertDialogTriggerProps as AlertDialogTriggerPrimitiveProps,
|
|
10
|
+
AlertDialogPortal as AlertDialogPortalPrimitive,
|
|
11
|
+
type AlertDialogPortalProps as AlertDialogPortalPrimitiveProps,
|
|
12
|
+
AlertDialogOverlay as AlertDialogOverlayPrimitive,
|
|
13
|
+
type AlertDialogOverlayProps as AlertDialogOverlayPrimitiveProps,
|
|
14
|
+
AlertDialogTitle as AlertDialogTitlePrimitive,
|
|
15
|
+
type AlertDialogTitleProps as AlertDialogTitlePrimitiveProps,
|
|
16
|
+
AlertDialogDescription as AlertDialogDescriptionPrimitive,
|
|
17
|
+
type AlertDialogDescriptionProps as AlertDialogDescriptionPrimitiveProps,
|
|
18
|
+
AlertDialogAction as AlertDialogActionPrimitive,
|
|
19
|
+
type AlertDialogActionProps as AlertDialogActionPrimitiveProps,
|
|
20
|
+
AlertDialogCancel as AlertDialogCancelPrimitive,
|
|
21
|
+
type AlertDialogCancelProps as AlertDialogCancelPrimitiveProps,
|
|
22
|
+
AlertDialogContent as AlertDialogContentPrimitive,
|
|
23
|
+
type AlertDialogContentProps as AlertDialogContentPrimitiveProps,
|
|
24
|
+
} from '@radix-ui/react-alert-dialog';
|
|
25
|
+
import { createContext } from '@radix-ui/react-context';
|
|
26
|
+
import React, { forwardRef, type ForwardRefExoticComponent, type FunctionComponent } from 'react';
|
|
27
|
+
|
|
28
|
+
import { useThemeContext } from '../../hooks';
|
|
29
|
+
import { type ThemedClassName } from '../../util';
|
|
30
|
+
import { ElevationProvider } from '../ElevationProvider';
|
|
31
|
+
|
|
32
|
+
type AlertDialogRootProps = AlertDialogRootPrimitiveProps;
|
|
33
|
+
|
|
34
|
+
const AlertDialogRoot: FunctionComponent<AlertDialogRootProps> = AlertDialogRootPrimitive;
|
|
35
|
+
|
|
36
|
+
type AlertDialogTriggerProps = AlertDialogTriggerPrimitiveProps;
|
|
37
|
+
|
|
38
|
+
const AlertDialogTrigger: FunctionComponent<AlertDialogTriggerProps> = AlertDialogTriggerPrimitive;
|
|
39
|
+
|
|
40
|
+
type AlertDialogPortalProps = AlertDialogPortalPrimitiveProps;
|
|
41
|
+
|
|
42
|
+
const AlertDialogPortal: FunctionComponent<AlertDialogPortalProps> = AlertDialogPortalPrimitive;
|
|
43
|
+
|
|
44
|
+
type AlertDialogCancelProps = AlertDialogCancelPrimitiveProps;
|
|
45
|
+
|
|
46
|
+
const AlertDialogCancel: FunctionComponent<AlertDialogCancelProps> = AlertDialogCancelPrimitive;
|
|
47
|
+
|
|
48
|
+
type AlertDialogActionProps = AlertDialogActionPrimitiveProps;
|
|
49
|
+
|
|
50
|
+
const AlertDialogAction: FunctionComponent<AlertDialogActionProps> = AlertDialogActionPrimitive;
|
|
51
|
+
|
|
52
|
+
type AlertDialogTitleProps = ThemedClassName<AlertDialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
53
|
+
|
|
54
|
+
const AlertDialogTitle: ForwardRefExoticComponent<AlertDialogTitleProps> = forwardRef<
|
|
55
|
+
HTMLHeadingElement,
|
|
56
|
+
AlertDialogTitleProps
|
|
57
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
58
|
+
const { tx } = useThemeContext();
|
|
59
|
+
return (
|
|
60
|
+
<AlertDialogTitlePrimitive
|
|
61
|
+
{...props}
|
|
62
|
+
className={tx('dialog.title', 'dialog--alert__title', { srOnly }, classNames)}
|
|
63
|
+
ref={forwardedRef}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
type AlertDialogDescriptionProps = ThemedClassName<AlertDialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
69
|
+
|
|
70
|
+
const AlertDialogDescription: ForwardRefExoticComponent<AlertDialogTitleProps> = forwardRef<
|
|
71
|
+
HTMLParagraphElement,
|
|
72
|
+
AlertDialogDescriptionProps
|
|
73
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
74
|
+
const { tx } = useThemeContext();
|
|
75
|
+
return (
|
|
76
|
+
<AlertDialogDescriptionPrimitive
|
|
77
|
+
{...props}
|
|
78
|
+
className={tx('dialog.description', 'dialog--alert__description', { srOnly }, classNames)}
|
|
79
|
+
ref={forwardedRef}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
85
|
+
const ALERT_DIALOG_OVERLAY_NAME = 'AlertDialogOverlay';
|
|
86
|
+
const ALERT_DIALOG_CONTENT_NAME = 'AlertDialogContent';
|
|
87
|
+
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
88
|
+
ALERT_DIALOG_OVERLAY_NAME,
|
|
89
|
+
{
|
|
90
|
+
inOverlayLayout: false,
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
type AlertDialogOverlayProps = ThemedClassName<AlertDialogOverlayPrimitiveProps>;
|
|
95
|
+
|
|
96
|
+
const AlertDialogOverlay: ForwardRefExoticComponent<AlertDialogOverlayProps> = forwardRef<
|
|
97
|
+
HTMLDivElement,
|
|
98
|
+
AlertDialogOverlayProps
|
|
99
|
+
>(({ classNames, children, ...props }, forwardedRef) => {
|
|
100
|
+
const { tx } = useThemeContext();
|
|
101
|
+
return (
|
|
102
|
+
<AlertDialogOverlayPrimitive
|
|
103
|
+
{...props}
|
|
104
|
+
className={tx('dialog.overlay', 'dialog--alert__overlay', {}, classNames)}
|
|
105
|
+
ref={forwardedRef}
|
|
106
|
+
>
|
|
107
|
+
<OverlayLayoutProvider inOverlayLayout>{children}</OverlayLayoutProvider>
|
|
108
|
+
</AlertDialogOverlayPrimitive>
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
|
|
113
|
+
|
|
114
|
+
type AlertDialogContentProps = ThemedClassName<AlertDialogContentPrimitiveProps>;
|
|
115
|
+
|
|
116
|
+
const AlertDialogContent: ForwardRefExoticComponent<AlertDialogContentProps> = forwardRef<
|
|
117
|
+
HTMLDivElement,
|
|
118
|
+
AlertDialogContentProps
|
|
119
|
+
>(({ classNames, children, ...props }, forwardedRef) => {
|
|
120
|
+
const { tx } = useThemeContext();
|
|
121
|
+
const { inOverlayLayout } = useOverlayLayoutContext(ALERT_DIALOG_CONTENT_NAME);
|
|
122
|
+
return (
|
|
123
|
+
<AlertDialogContentPrimitive
|
|
124
|
+
{...props}
|
|
125
|
+
className={tx('dialog.content', 'dialog--alert', { inOverlayLayout }, classNames)}
|
|
126
|
+
ref={forwardedRef}
|
|
127
|
+
>
|
|
128
|
+
<ElevationProvider elevation='chrome'>{children}</ElevationProvider>
|
|
129
|
+
</AlertDialogContentPrimitive>
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
|
|
134
|
+
|
|
135
|
+
export const AlertDialog = {
|
|
136
|
+
Root: AlertDialogRoot,
|
|
137
|
+
Trigger: AlertDialogTrigger,
|
|
138
|
+
Portal: AlertDialogPortal,
|
|
139
|
+
Overlay: AlertDialogOverlay,
|
|
140
|
+
Content: AlertDialogContent,
|
|
141
|
+
Title: AlertDialogTitle,
|
|
142
|
+
Description: AlertDialogDescription,
|
|
143
|
+
Cancel: AlertDialogCancel,
|
|
144
|
+
Action: AlertDialogAction,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type {
|
|
148
|
+
AlertDialogRootProps,
|
|
149
|
+
AlertDialogTriggerProps,
|
|
150
|
+
AlertDialogPortalProps,
|
|
151
|
+
AlertDialogOverlayProps,
|
|
152
|
+
AlertDialogContentProps,
|
|
153
|
+
AlertDialogTitleProps,
|
|
154
|
+
AlertDialogDescriptionProps,
|
|
155
|
+
AlertDialogCancelProps,
|
|
156
|
+
AlertDialogActionProps,
|
|
157
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxosTheme';
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { Dialog } from './Dialog';
|
|
10
|
+
import { Button } from '../Buttons';
|
|
11
|
+
|
|
12
|
+
type StorybookDialogProps = Partial<{
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
body: string;
|
|
16
|
+
closeTrigger: string;
|
|
17
|
+
openTrigger: string;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
const StorybookDialog = ({ title, openTrigger, description, body, closeTrigger }: StorybookDialogProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<Dialog.Root defaultOpen>
|
|
23
|
+
<Dialog.Trigger asChild>
|
|
24
|
+
<Button>{openTrigger}</Button>
|
|
25
|
+
</Dialog.Trigger>
|
|
26
|
+
<Dialog.Overlay>
|
|
27
|
+
<Dialog.Content>
|
|
28
|
+
<Dialog.Title>{title}</Dialog.Title>
|
|
29
|
+
<Dialog.Description>{description}</Dialog.Description>
|
|
30
|
+
<p className='mbs-2 mbe-4'>{body}</p>
|
|
31
|
+
<Dialog.Close asChild>
|
|
32
|
+
<Button variant='primary'>{closeTrigger}</Button>
|
|
33
|
+
</Dialog.Close>
|
|
34
|
+
</Dialog.Content>
|
|
35
|
+
</Dialog.Overlay>
|
|
36
|
+
</Dialog.Root>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
component: StorybookDialog,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Default = {
|
|
45
|
+
args: {
|
|
46
|
+
title: 'Dialog title',
|
|
47
|
+
openTrigger: 'Open Dialog',
|
|
48
|
+
description: 'Dialog description',
|
|
49
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
|
|
50
|
+
closeTrigger: 'Close trigger',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext } from '@radix-ui/react-context';
|
|
6
|
+
import {
|
|
7
|
+
type DialogProps as DialogRootPrimitiveProps,
|
|
8
|
+
Root as DialogRootPrimitive,
|
|
9
|
+
DialogTrigger as DialogTriggerPrimitive,
|
|
10
|
+
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
11
|
+
DialogPortal as DialogPortalPrimitive,
|
|
12
|
+
type DialogPortalProps as DialogPortalPrimitiveProps,
|
|
13
|
+
DialogOverlay as DialogOverlayPrimitive,
|
|
14
|
+
type DialogOverlayProps as DialogOverlayPrimitiveProps,
|
|
15
|
+
DialogTitle as DialogTitlePrimitive,
|
|
16
|
+
type DialogTitleProps as DialogTitlePrimitiveProps,
|
|
17
|
+
DialogDescription as DialogDescriptionPrimitive,
|
|
18
|
+
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
19
|
+
DialogClose as DialogClosePrimitive,
|
|
20
|
+
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
21
|
+
DialogContent as DialogContentPrimitive,
|
|
22
|
+
type DialogContentProps as DialogContentPrimitiveProps,
|
|
23
|
+
} from '@radix-ui/react-dialog';
|
|
24
|
+
import React, { forwardRef, type ForwardRefExoticComponent, type FunctionComponent } from 'react';
|
|
25
|
+
|
|
26
|
+
import { useThemeContext } from '../../hooks';
|
|
27
|
+
import { type ThemedClassName } from '../../util';
|
|
28
|
+
import { ElevationProvider } from '../ElevationProvider';
|
|
29
|
+
|
|
30
|
+
type DialogRootProps = DialogRootPrimitiveProps;
|
|
31
|
+
|
|
32
|
+
const DialogRoot: FunctionComponent<DialogRootProps> = DialogRootPrimitive;
|
|
33
|
+
|
|
34
|
+
type DialogTriggerProps = DialogTriggerPrimitiveProps;
|
|
35
|
+
|
|
36
|
+
const DialogTrigger: FunctionComponent<DialogTriggerProps> = DialogTriggerPrimitive;
|
|
37
|
+
|
|
38
|
+
type DialogPortalProps = DialogPortalPrimitiveProps;
|
|
39
|
+
|
|
40
|
+
const DialogPortal: FunctionComponent<DialogPortalProps> = DialogPortalPrimitive;
|
|
41
|
+
|
|
42
|
+
type DialogTitleProps = ThemedClassName<DialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
43
|
+
|
|
44
|
+
const DialogTitle: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
45
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
46
|
+
const { tx } = useThemeContext();
|
|
47
|
+
return (
|
|
48
|
+
<DialogTitlePrimitive
|
|
49
|
+
{...props}
|
|
50
|
+
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
51
|
+
ref={forwardedRef}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
58
|
+
|
|
59
|
+
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
60
|
+
HTMLParagraphElement,
|
|
61
|
+
DialogDescriptionProps
|
|
62
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
63
|
+
const { tx } = useThemeContext();
|
|
64
|
+
return (
|
|
65
|
+
<DialogDescriptionPrimitive
|
|
66
|
+
{...props}
|
|
67
|
+
className={tx('dialog.description', 'dialog__description', { srOnly }, classNames)}
|
|
68
|
+
ref={forwardedRef}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
74
|
+
|
|
75
|
+
const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
|
|
76
|
+
|
|
77
|
+
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
78
|
+
const DIALOG_OVERLAY_NAME = 'DialogOverlay';
|
|
79
|
+
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
80
|
+
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(DIALOG_OVERLAY_NAME, {
|
|
81
|
+
inOverlayLayout: false,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps>;
|
|
85
|
+
|
|
86
|
+
const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<HTMLDivElement, DialogOverlayProps>(
|
|
87
|
+
({ classNames, children, ...props }, forwardedRef) => {
|
|
88
|
+
const { tx } = useThemeContext();
|
|
89
|
+
return (
|
|
90
|
+
<DialogOverlayPrimitive
|
|
91
|
+
{...props}
|
|
92
|
+
className={tx('dialog.overlay', 'dialog__overlay', {}, classNames)}
|
|
93
|
+
ref={forwardedRef}
|
|
94
|
+
>
|
|
95
|
+
<OverlayLayoutProvider inOverlayLayout>{children}</OverlayLayoutProvider>
|
|
96
|
+
</DialogOverlayPrimitive>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
102
|
+
|
|
103
|
+
type DialogContentProps = ThemedClassName<DialogContentPrimitiveProps>;
|
|
104
|
+
|
|
105
|
+
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
106
|
+
({ classNames, children, ...props }, forwardedRef) => {
|
|
107
|
+
const { tx } = useThemeContext();
|
|
108
|
+
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
109
|
+
return (
|
|
110
|
+
<DialogContentPrimitive
|
|
111
|
+
{...props}
|
|
112
|
+
className={tx('dialog.content', 'dialog', { inOverlayLayout }, classNames)}
|
|
113
|
+
ref={forwardedRef}
|
|
114
|
+
>
|
|
115
|
+
<ElevationProvider elevation='chrome'>{children}</ElevationProvider>
|
|
116
|
+
</DialogContentPrimitive>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
122
|
+
|
|
123
|
+
export const Dialog = {
|
|
124
|
+
Root: DialogRoot,
|
|
125
|
+
Trigger: DialogTrigger,
|
|
126
|
+
Portal: DialogPortal,
|
|
127
|
+
Overlay: DialogOverlay,
|
|
128
|
+
Content: DialogContent,
|
|
129
|
+
Title: DialogTitle,
|
|
130
|
+
Description: DialogDescription,
|
|
131
|
+
Close: DialogClose,
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type {
|
|
135
|
+
DialogRootProps,
|
|
136
|
+
DialogTriggerProps,
|
|
137
|
+
DialogPortalProps,
|
|
138
|
+
DialogOverlayProps,
|
|
139
|
+
DialogContentProps,
|
|
140
|
+
DialogTitleProps,
|
|
141
|
+
DialogDescriptionProps,
|
|
142
|
+
DialogCloseProps,
|
|
143
|
+
};
|