@dxos/shell 0.3.11-main.008b7c6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +21 -0
- package/dist/lib/browser/chunk-ZSTKOCBT.mjs +10 -0
- package/dist/lib/browser/chunk-ZSTKOCBT.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/react.mjs +3617 -0
- package/dist/lib/browser/react.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +179 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/types/src/components/AuthCode.d.ts +8 -0
- package/dist/types/src/components/AuthCode.d.ts.map +1 -0
- package/dist/types/src/components/AuthCode.js +26 -0
- package/dist/types/src/components/AuthCode.js.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +9 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.js +46 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.js.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +9 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.js +65 -0
- package/dist/types/src/components/Clipboard/CopyButton.js.map +1 -0
- package/dist/types/src/components/Clipboard/index.d.ts +3 -0
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/index.js +22 -0
- package/dist/types/src/components/Clipboard/index.js.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts +17 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.js +29 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.js.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts +35 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js +45 -0
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.js.map +1 -0
- package/dist/types/src/components/CompoundButton/index.d.ts +2 -0
- package/dist/types/src/components/CompoundButton/index.d.ts.map +1 -0
- package/dist/types/src/components/CompoundButton/index.js +21 -0
- package/dist/types/src/components/CompoundButton/index.js.map +1 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts +7 -0
- package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/DeviceList.js +29 -0
- package/dist/types/src/components/IdentityList/DeviceList.js.map +1 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts +11 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.js +47 -0
- package/dist/types/src/components/IdentityList/IdentityListItem.js.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts +13 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.js +54 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.js.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts +17 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js +26 -0
- package/dist/types/src/components/IdentityList/SpaceMemberList.stories.js.map +1 -0
- package/dist/types/src/components/IdentityList/index.d.ts +4 -0
- package/dist/types/src/components/IdentityList/index.d.ts.map +1 -0
- package/dist/types/src/components/IdentityList/index.js +23 -0
- package/dist/types/src/components/IdentityList/index.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.d.ts +11 -0
- package/dist/types/src/components/InvitationList/InvitationList.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.js +22 -0
- package/dist/types/src/components/InvitationList/InvitationList.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts +17 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.js +39 -0
- package/dist/types/src/components/InvitationList/InvitationList.stories.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts +7 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.js +42 -0
- package/dist/types/src/components/InvitationList/InvitationListContainer.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts +12 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.js +103 -0
- package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts +9 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.js +3 -0
- package/dist/types/src/components/InvitationList/InvitationListProps.js.map +1 -0
- package/dist/types/src/components/InvitationList/index.d.ts +4 -0
- package/dist/types/src/components/InvitationList/index.d.ts.map +1 -0
- package/dist/types/src/components/InvitationList/index.js +23 -0
- package/dist/types/src/components/InvitationList/index.js.map +1 -0
- package/dist/types/src/components/Panel/Action.d.ts +20 -0
- package/dist/types/src/components/Panel/Action.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Action.js +93 -0
- package/dist/types/src/components/Panel/Action.js.map +1 -0
- package/dist/types/src/components/Panel/Actions.d.ts +11 -0
- package/dist/types/src/components/Panel/Actions.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Actions.js +36 -0
- package/dist/types/src/components/Panel/Actions.js.map +1 -0
- package/dist/types/src/components/Panel/CloseButton.d.ts +5 -0
- package/dist/types/src/components/Panel/CloseButton.d.ts.map +1 -0
- package/dist/types/src/components/Panel/CloseButton.js +21 -0
- package/dist/types/src/components/Panel/CloseButton.js.map +1 -0
- package/dist/types/src/components/Panel/Emoji.d.ts +7 -0
- package/dist/types/src/components/Panel/Emoji.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Emoji.js +24 -0
- package/dist/types/src/components/Panel/Emoji.js.map +1 -0
- package/dist/types/src/components/Panel/Heading.d.ts +16 -0
- package/dist/types/src/components/Panel/Heading.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Heading.js +39 -0
- package/dist/types/src/components/Panel/Heading.js.map +1 -0
- package/dist/types/src/components/Panel/Input.d.ts +11 -0
- package/dist/types/src/components/Panel/Input.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Input.js +19 -0
- package/dist/types/src/components/Panel/Input.js.map +1 -0
- package/dist/types/src/components/Panel/Label.d.ts +4 -0
- package/dist/types/src/components/Panel/Label.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Label.js +17 -0
- package/dist/types/src/components/Panel/Label.js.map +1 -0
- package/dist/types/src/components/Panel/Panel.stories.d.ts +13 -0
- package/dist/types/src/components/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Panel.stories.js +44 -0
- package/dist/types/src/components/Panel/Panel.stories.js.map +1 -0
- package/dist/types/src/components/Panel/StepHeading.d.ts +5 -0
- package/dist/types/src/components/Panel/StepHeading.d.ts.map +1 -0
- package/dist/types/src/components/Panel/StepHeading.js +35 -0
- package/dist/types/src/components/Panel/StepHeading.js.map +1 -0
- package/dist/types/src/components/Panel/index.d.ts +9 -0
- package/dist/types/src/components/Panel/index.d.ts.map +1 -0
- package/dist/types/src/components/Panel/index.js +28 -0
- package/dist/types/src/components/Panel/index.js.map +1 -0
- package/dist/types/src/components/SpaceListItem.d.ts +7 -0
- package/dist/types/src/components/SpaceListItem.d.ts.map +1 -0
- package/dist/types/src/components/SpaceListItem.js +46 -0
- package/dist/types/src/components/SpaceListItem.js.map +1 -0
- package/dist/types/src/components/StorybookDialog.d.ts +6 -0
- package/dist/types/src/components/StorybookDialog.d.ts.map +1 -0
- package/dist/types/src/components/StorybookDialog.js +23 -0
- package/dist/types/src/components/StorybookDialog.js.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.d.ts +39 -0
- package/dist/types/src/components/Viewport/Viewport.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.js +73 -0
- package/dist/types/src/components/Viewport/Viewport.js.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.stories.d.ts +17 -0
- package/dist/types/src/components/Viewport/Viewport.stories.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/Viewport.stories.js +51 -0
- package/dist/types/src/components/Viewport/Viewport.stories.js.map +1 -0
- package/dist/types/src/components/Viewport/index.d.ts +2 -0
- package/dist/types/src/components/Viewport/index.d.ts.map +1 -0
- package/dist/types/src/components/Viewport/index.js +21 -0
- package/dist/types/src/components/Viewport/index.js.map +1 -0
- package/dist/types/src/components/index.d.ts +9 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/components/index.js +28 -0
- package/dist/types/src/components/index.js.map +1 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts +7 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js +26 -0
- package/dist/types/src/composites/IdentityDialog/IdentityDialog.js.map +1 -0
- package/dist/types/src/composites/IdentityDialog/index.d.ts +2 -0
- package/dist/types/src/composites/IdentityDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityDialog/index.js +21 -0
- package/dist/types/src/composites/IdentityDialog/index.js.map +1 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts +6 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.d.ts.map +1 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.js +27 -0
- package/dist/types/src/composites/JoinDialog/JoinDialog.js.map +1 -0
- package/dist/types/src/composites/JoinDialog/index.d.ts +2 -0
- package/dist/types/src/composites/JoinDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/JoinDialog/index.js +21 -0
- package/dist/types/src/composites/JoinDialog/index.js.map +1 -0
- package/dist/types/src/composites/Shell/Shell.d.ts +6 -0
- package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/Shell.js +90 -0
- package/dist/types/src/composites/Shell/Shell.js.map +1 -0
- package/dist/types/src/composites/Shell/ShellContext.d.ts +30 -0
- package/dist/types/src/composites/Shell/ShellContext.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/ShellContext.js +129 -0
- package/dist/types/src/composites/Shell/ShellContext.js.map +1 -0
- package/dist/types/src/composites/Shell/index.d.ts +4 -0
- package/dist/types/src/composites/Shell/index.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/index.js +23 -0
- package/dist/types/src/composites/Shell/index.js.map +1 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts +16 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.js +38 -0
- package/dist/types/src/composites/Shell/memory-shell-runtime.js.map +1 -0
- package/dist/types/src/composites/Shell/run-shell.d.ts +3 -0
- package/dist/types/src/composites/Shell/run-shell.d.ts.map +1 -0
- package/dist/types/src/composites/Shell/run-shell.js +54 -0
- package/dist/types/src/composites/Shell/run-shell.js.map +1 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts +6 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.d.ts.map +1 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.js +26 -0
- package/dist/types/src/composites/SpaceDialog/SpaceDialog.js.map +1 -0
- package/dist/types/src/composites/SpaceDialog/index.d.ts +2 -0
- package/dist/types/src/composites/SpaceDialog/index.d.ts.map +1 -0
- package/dist/types/src/composites/SpaceDialog/index.js +21 -0
- package/dist/types/src/composites/SpaceDialog/index.js.map +1 -0
- package/dist/types/src/composites/index.d.ts +5 -0
- package/dist/types/src/composites/index.d.ts.map +1 -0
- package/dist/types/src/composites/index.js +24 -0
- package/dist/types/src/composites/index.js.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/index.js +10 -0
- package/dist/types/src/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +4 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +124 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +22 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +86 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +27 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js +6 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +46 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.js +79 -0
- package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts +3 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/index.js +22 -0
- package/dist/types/src/panels/IdentityPanel/index.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +9 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +85 -0
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +15 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +62 -0
- package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +3 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.js +22 -0
- package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts +10 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.js +45 -0
- package/dist/types/src/panels/JoinPanel/JoinHeading.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts +4 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.js +293 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts +92 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js +74 -0
- package/dist/types/src/panels/JoinPanel/JoinPanel.stories.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts +91 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.js +6 -0
- package/dist/types/src/panels/JoinPanel/JoinPanelProps.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/index.d.ts +3 -0
- package/dist/types/src/panels/JoinPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/index.js +22 -0
- package/dist/types/src/panels/JoinPanel/index.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts +87 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js +402 -0
- package/dist/types/src/panels/JoinPanel/joinMachine.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts +4 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js +34 -0
- package/dist/types/src/panels/JoinPanel/steps/AdditionMethodChooser.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts +8 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js +56 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityAdded.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts +12 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js +67 -0
- package/dist/types/src/panels/JoinPanel/steps/IdentityInput.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts +9 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js +44 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAccepted.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts +11 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js +72 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationAuthenticator.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts +8 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js +68 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationInput.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts +11 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js +49 -0
- package/dist/types/src/panels/JoinPanel/steps/InvitationRescuer.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts +12 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js +63 -0
- package/dist/types/src/panels/JoinPanel/steps/ResetIdentity.js.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts +9 -0
- package/dist/types/src/panels/JoinPanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/JoinPanel/steps/index.js +28 -0
- package/dist/types/src/panels/JoinPanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/Panels.stories.d.ts +22 -0
- package/dist/types/src/panels/Panels.stories.d.ts.map +1 -0
- package/dist/types/src/panels/Panels.stories.js +69 -0
- package/dist/types/src/panels/Panels.stories.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts +4 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.js +93 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts +30 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js +183 -0
- package/dist/types/src/panels/SpacePanel/SpacePanel.stories.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts +30 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.js +6 -0
- package/dist/types/src/panels/SpacePanel/SpacePanelProps.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/index.d.ts +3 -0
- package/dist/types/src/panels/SpacePanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/index.js +22 -0
- package/dist/types/src/panels/SpacePanel/index.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts +35 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.js +46 -0
- package/dist/types/src/panels/SpacePanel/spaceMachine.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts +15 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +120 -0
- package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/index.d.ts +2 -0
- package/dist/types/src/panels/SpacePanel/steps/index.d.ts.map +1 -0
- package/dist/types/src/panels/SpacePanel/steps/index.js +21 -0
- package/dist/types/src/panels/SpacePanel/steps/index.js.map +1 -0
- package/dist/types/src/panels/index.d.ts +4 -0
- package/dist/types/src/panels/index.d.ts.map +1 -0
- package/dist/types/src/panels/index.js +23 -0
- package/dist/types/src/panels/index.js.map +1 -0
- package/dist/types/src/playwright/invitations-manager.d.ts +26 -0
- package/dist/types/src/playwright/invitations-manager.d.ts.map +1 -0
- package/dist/types/src/playwright/invitations-manager.js +142 -0
- package/dist/types/src/playwright/invitations-manager.js.map +1 -0
- package/dist/types/src/playwright/invitations.spec.d.ts +2 -0
- package/dist/types/src/playwright/invitations.spec.d.ts.map +1 -0
- package/dist/types/src/playwright/invitations.spec.js +298 -0
- package/dist/types/src/playwright/invitations.spec.js.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +3 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.js +8 -0
- package/dist/types/src/playwright/playwright.config.js.map +1 -0
- package/dist/types/src/react.d.ts +6 -0
- package/dist/types/src/react.d.ts.map +1 -0
- package/dist/types/src/react.js +25 -0
- package/dist/types/src/react.js.map +1 -0
- package/dist/types/src/steps/InvitationManager.d.ts +7 -0
- package/dist/types/src/steps/InvitationManager.d.ts.map +1 -0
- package/dist/types/src/steps/InvitationManager.js +80 -0
- package/dist/types/src/steps/InvitationManager.js.map +1 -0
- package/dist/types/src/steps/StepProps.d.ts +14 -0
- package/dist/types/src/steps/StepProps.d.ts.map +1 -0
- package/dist/types/src/steps/StepProps.js +6 -0
- package/dist/types/src/steps/StepProps.js.map +1 -0
- package/dist/types/src/steps/index.d.ts +3 -0
- package/dist/types/src/steps/index.d.ts.map +1 -0
- package/dist/types/src/steps/index.js +22 -0
- package/dist/types/src/steps/index.js.map +1 -0
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts +22 -0
- package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -0
- package/dist/types/src/stories/Invitations.e2e-stories.js +146 -0
- package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -0
- package/dist/types/src/styles/index.d.ts +3 -0
- package/dist/types/src/styles/index.d.ts.map +1 -0
- package/dist/types/src/styles/index.js +22 -0
- package/dist/types/src/styles/index.js.map +1 -0
- package/dist/types/src/styles/invitationStatusStyles.d.ts +20 -0
- package/dist/types/src/styles/invitationStatusStyles.d.ts.map +1 -0
- package/dist/types/src/styles/invitationStatusStyles.js +41 -0
- package/dist/types/src/styles/invitationStatusStyles.js.map +1 -0
- package/dist/types/src/styles/panelStyles.d.ts +2 -0
- package/dist/types/src/styles/panelStyles.d.ts.map +1 -0
- package/dist/types/src/styles/panelStyles.js +8 -0
- package/dist/types/src/styles/panelStyles.js.map +1 -0
- package/dist/types/src/testing/fixtures/identities.d.ts +3 -0
- package/dist/types/src/testing/fixtures/identities.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/identities.js +18 -0
- package/dist/types/src/testing/fixtures/identities.js.map +1 -0
- package/dist/types/src/testing/fixtures/index.d.ts +3 -0
- package/dist/types/src/testing/fixtures/index.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/index.js +22 -0
- package/dist/types/src/testing/fixtures/index.js.map +1 -0
- package/dist/types/src/testing/fixtures/invitations.d.ts +3 -0
- package/dist/types/src/testing/fixtures/invitations.d.ts.map +1 -0
- package/dist/types/src/testing/fixtures/invitations.js +25 -0
- package/dist/types/src/testing/fixtures/invitations.js.map +1 -0
- package/dist/types/src/testing/index.d.ts +4 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.js +23 -0
- package/dist/types/src/testing/index.js.map +1 -0
- package/dist/types/src/testing/scoped-shell-manager.d.ts +17 -0
- package/dist/types/src/testing/scoped-shell-manager.d.ts.map +1 -0
- package/dist/types/src/testing/scoped-shell-manager.js +71 -0
- package/dist/types/src/testing/scoped-shell-manager.js.map +1 -0
- package/dist/types/src/testing/shell-manager.d.ts +24 -0
- package/dist/types/src/testing/shell-manager.d.ts.map +1 -0
- package/dist/types/src/testing/shell-manager.js +85 -0
- package/dist/types/src/testing/shell-manager.js.map +1 -0
- package/dist/types/src/translations/index.d.ts +5 -0
- package/dist/types/src/translations/index.d.ts.map +1 -0
- package/dist/types/src/translations/index.js +32 -0
- package/dist/types/src/translations/index.js.map +1 -0
- package/dist/types/src/translations/locales/en-US.d.ts +97 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -0
- package/dist/types/src/translations/locales/en-US.js +103 -0
- package/dist/types/src/translations/locales/en-US.js.map +1 -0
- package/dist/types/src/types/FailReason.d.ts +2 -0
- package/dist/types/src/types/FailReason.d.ts.map +1 -0
- package/dist/types/src/types/FailReason.js +6 -0
- package/dist/types/src/types/FailReason.js.map +1 -0
- package/dist/types/src/types/IInvitation.d.ts +7 -0
- package/dist/types/src/types/IInvitation.d.ts.map +1 -0
- package/dist/types/src/types/IInvitation.js +6 -0
- package/dist/types/src/types/IInvitation.js.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/index.js +22 -0
- package/dist/types/src/types/index.js.map +1 -0
- package/dist/types/src/util/index.d.ts +3 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/index.js +22 -0
- package/dist/types/src/util/index.js.map +1 -0
- package/dist/types/src/util/invitationStatusValue.d.ts +8 -0
- package/dist/types/src/util/invitationStatusValue.d.ts.map +1 -0
- package/dist/types/src/util/invitationStatusValue.js +24 -0
- package/dist/types/src/util/invitationStatusValue.js.map +1 -0
- package/dist/types/src/util/toEmoji.d.ts +2 -0
- package/dist/types/src/util/toEmoji.d.ts.map +1 -0
- package/dist/types/src/util/toEmoji.js +26 -0
- package/dist/types/src/util/toEmoji.js.map +1 -0
- package/package.json +79 -0
- package/src/components/AuthCode.tsx +36 -0
- package/src/components/Clipboard/ClipboardProvider.tsx +26 -0
- package/src/components/Clipboard/CopyButton.tsx +70 -0
- package/src/components/Clipboard/index.ts +6 -0
- package/src/components/CompoundButton/CompoundButton.stories.tsx +49 -0
- package/src/components/CompoundButton/CompoundButton.tsx +89 -0
- package/src/components/CompoundButton/index.ts +5 -0
- package/src/components/IdentityList/DeviceList.tsx +45 -0
- package/src/components/IdentityList/IdentityListItem.tsx +42 -0
- package/src/components/IdentityList/SpaceMemberList.stories.tsx +24 -0
- package/src/components/IdentityList/SpaceMemberList.tsx +65 -0
- package/src/components/IdentityList/index.ts +7 -0
- package/src/components/InvitationList/InvitationList.stories.tsx +44 -0
- package/src/components/InvitationList/InvitationList.tsx +31 -0
- package/src/components/InvitationList/InvitationListContainer.tsx +27 -0
- package/src/components/InvitationList/InvitationListItem.tsx +183 -0
- package/src/components/InvitationList/InvitationListProps.ts +9 -0
- package/src/components/InvitationList/index.ts +7 -0
- package/src/components/Panel/Action.tsx +142 -0
- package/src/components/Panel/Actions.tsx +31 -0
- package/src/components/Panel/CloseButton.tsx +24 -0
- package/src/components/Panel/Emoji.tsx +36 -0
- package/src/components/Panel/Heading.tsx +32 -0
- package/src/components/Panel/Input.tsx +27 -0
- package/src/components/Panel/Label.tsx +14 -0
- package/src/components/Panel/Panel.stories.tsx +52 -0
- package/src/components/Panel/StepHeading.tsx +17 -0
- package/src/components/Panel/index.ts +12 -0
- package/src/components/SpaceListItem.tsx +35 -0
- package/src/components/StorybookDialog.tsx +33 -0
- package/src/components/Viewport/Viewport.stories.tsx +66 -0
- package/src/components/Viewport/Viewport.tsx +120 -0
- package/src/components/Viewport/index.tsx +5 -0
- package/src/components/index.ts +12 -0
- package/src/composites/IdentityDialog/IdentityDialog.tsx +39 -0
- package/src/composites/IdentityDialog/index.ts +5 -0
- package/src/composites/JoinDialog/JoinDialog.tsx +40 -0
- package/src/composites/JoinDialog/index.ts +5 -0
- package/src/composites/Shell/Shell.tsx +98 -0
- package/src/composites/Shell/ShellContext.tsx +163 -0
- package/src/composites/Shell/index.ts +7 -0
- package/src/composites/Shell/memory-shell-runtime.ts +50 -0
- package/src/composites/Shell/run-shell.tsx +38 -0
- package/src/composites/SpaceDialog/SpaceDialog.tsx +37 -0
- package/src/composites/SpaceDialog/index.ts +5 -0
- package/src/composites/index.ts +8 -0
- package/src/index.ts +7 -0
- package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +113 -0
- package/src/panels/IdentityPanel/IdentityPanel.tsx +158 -0
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +36 -0
- package/src/panels/IdentityPanel/identityMachine.ts +131 -0
- package/src/panels/IdentityPanel/index.ts +6 -0
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +96 -0
- package/src/panels/IdentityPanel/steps/ProfileForm.tsx +79 -0
- package/src/panels/IdentityPanel/steps/index.ts +6 -0
- package/src/panels/JoinPanel/JoinHeading.tsx +49 -0
- package/src/panels/JoinPanel/JoinPanel.stories.tsx +91 -0
- package/src/panels/JoinPanel/JoinPanel.tsx +415 -0
- package/src/panels/JoinPanel/JoinPanelProps.ts +132 -0
- package/src/panels/JoinPanel/index.ts +6 -0
- package/src/panels/JoinPanel/joinMachine.ts +536 -0
- package/src/panels/JoinPanel/steps/AdditionMethodChooser.tsx +65 -0
- package/src/panels/JoinPanel/steps/IdentityAdded.tsx +75 -0
- package/src/panels/JoinPanel/steps/IdentityInput.tsx +86 -0
- package/src/panels/JoinPanel/steps/InvitationAccepted.tsx +43 -0
- package/src/panels/JoinPanel/steps/InvitationAuthenticator.tsx +99 -0
- package/src/panels/JoinPanel/steps/InvitationInput.tsx +102 -0
- package/src/panels/JoinPanel/steps/InvitationRescuer.tsx +102 -0
- package/src/panels/JoinPanel/steps/ResetIdentity.tsx +71 -0
- package/src/panels/JoinPanel/steps/index.ts +12 -0
- package/src/panels/Panels.stories.tsx +61 -0
- package/src/panels/SpacePanel/SpacePanel.stories.tsx +328 -0
- package/src/panels/SpacePanel/SpacePanel.tsx +122 -0
- package/src/panels/SpacePanel/SpacePanelProps.ts +40 -0
- package/src/panels/SpacePanel/index.ts +6 -0
- package/src/panels/SpacePanel/spaceMachine.ts +72 -0
- package/src/panels/SpacePanel/steps/SpaceManager.tsx +157 -0
- package/src/panels/SpacePanel/steps/index.ts +5 -0
- package/src/panels/index.ts +7 -0
- package/src/playwright/invitations-manager.ts +168 -0
- package/src/playwright/invitations.spec.ts +364 -0
- package/src/playwright/playwright.config.ts +7 -0
- package/src/react.ts +9 -0
- package/src/steps/InvitationManager.tsx +116 -0
- package/src/steps/StepProps.ts +17 -0
- package/src/steps/index.ts +6 -0
- package/src/stories/Invitations.e2e-stories.tsx +231 -0
- package/src/styles/index.ts +6 -0
- package/src/styles/invitationStatusStyles.ts +42 -0
- package/src/styles/panelStyles.ts +5 -0
- package/src/testing/fixtures/identities.ts +16 -0
- package/src/testing/fixtures/index.ts +6 -0
- package/src/testing/fixtures/invitations.ts +23 -0
- package/src/testing/index.ts +7 -0
- package/src/testing/scoped-shell-manager.ts +79 -0
- package/src/testing/shell-manager.ts +102 -0
- package/src/translations/index.ts +7 -0
- package/src/translations/locales/en-US.ts +101 -0
- package/src/types/FailReason.ts +5 -0
- package/src/types/IInvitation.ts +14 -0
- package/src/types/index.ts +6 -0
- package/src/util/index.ts +6 -0
- package/src/util/invitationStatusValue.ts +22 -0
- package/src/util/toEmoji.ts +22 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import "../chunk-ZSTKOCBT.mjs";
|
|
2
|
+
|
|
3
|
+
// packages/sdk/shell/src/testing/fixtures/identities.ts
|
|
4
|
+
import { PublicKey } from "@dxos/react-client";
|
|
5
|
+
import { SpaceMember } from "@dxos/react-client/echo";
|
|
6
|
+
var alice = {
|
|
7
|
+
identity: {
|
|
8
|
+
identityKey: PublicKey.random(),
|
|
9
|
+
profile: {
|
|
10
|
+
displayName: "Alice"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
presence: SpaceMember.PresenceState.ONLINE
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// packages/sdk/shell/src/testing/fixtures/invitations.ts
|
|
17
|
+
import { PublicKey as PublicKey2 } from "@dxos/react-client";
|
|
18
|
+
import { Invitation, CancellableInvitationObservable } from "@dxos/react-client/invitations";
|
|
19
|
+
var inviteWithState = (state) => new CancellableInvitationObservable({
|
|
20
|
+
initialInvitation: {
|
|
21
|
+
state,
|
|
22
|
+
invitationId: Math.random().toString(16).slice(2),
|
|
23
|
+
kind: Invitation.Kind.SPACE,
|
|
24
|
+
authMethod: Invitation.AuthMethod.NONE,
|
|
25
|
+
swarmKey: PublicKey2.random(),
|
|
26
|
+
type: Invitation.Type.INTERACTIVE,
|
|
27
|
+
authCode: [
|
|
28
|
+
Invitation.State.READY_FOR_AUTHENTICATION,
|
|
29
|
+
Invitation.State.AUTHENTICATING
|
|
30
|
+
].includes(state) ? "123456" : ""
|
|
31
|
+
},
|
|
32
|
+
subscriber: () => {
|
|
33
|
+
},
|
|
34
|
+
onCancel: async () => {
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// packages/sdk/shell/src/testing/scoped-shell-manager.ts
|
|
39
|
+
var ScopedShellManager = class {
|
|
40
|
+
authenticatorIsVisible(type, scope) {
|
|
41
|
+
return (scope || this.page).getByTestId(`${type === "device" ? "halo" : "space"}-auth-code-input`).isVisible();
|
|
42
|
+
}
|
|
43
|
+
async invitationFailed(scope, timeout = 3e3) {
|
|
44
|
+
const peer = scope || this.page;
|
|
45
|
+
try {
|
|
46
|
+
await peer.locator("[data-testid=invitation-rescuer-reset]:not([disabled])").waitFor({
|
|
47
|
+
timeout
|
|
48
|
+
});
|
|
49
|
+
return true;
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async inputInvitation(type, invitation, scope) {
|
|
55
|
+
await (scope || this.page).getByTestId(`${type === "device" ? "halo" : "space"}-invitation-input`).fill(invitation);
|
|
56
|
+
await this.page.keyboard.press("Enter");
|
|
57
|
+
}
|
|
58
|
+
async invitationInputContinue(type, scope) {
|
|
59
|
+
await (scope || this.page).getByTestId(`${type === "device" ? "halo" : "space"}-invitation-input-continue`).click();
|
|
60
|
+
}
|
|
61
|
+
async cancelInvitation(type, kind, scope) {
|
|
62
|
+
if (kind === "guest") {
|
|
63
|
+
await (scope || this.page).getByTestId(`${type === "device" ? "halo" : "space"}-invitation-authenticator-cancel`).click();
|
|
64
|
+
} else {
|
|
65
|
+
await (scope || this.page).getByTestId("cancel-invitation").nth(0).click();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async readyToAuthenticate(type, scope, timeout = 3e3) {
|
|
69
|
+
const peer = scope || this.page;
|
|
70
|
+
try {
|
|
71
|
+
await peer.locator(`[data-testid=${type === "device" ? "halo" : "space"}-auth-code-input]:not([disabled])`).waitFor({
|
|
72
|
+
timeout
|
|
73
|
+
});
|
|
74
|
+
return true;
|
|
75
|
+
} catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async authenticateInvitation(type, authCode, scope) {
|
|
80
|
+
const peer = scope || this.page;
|
|
81
|
+
await peer.getByTestId(`${type === "device" ? "halo" : "space"}-auth-code-input`).fill(authCode);
|
|
82
|
+
await peer.getByTestId(`${type === "device" ? "halo" : "space"}-invitation-authenticator-next`).click();
|
|
83
|
+
}
|
|
84
|
+
async clearAuthCode(type, scope) {
|
|
85
|
+
const peer = scope || this.page;
|
|
86
|
+
await peer.getByTestId(`${type === "device" ? "halo" : "space"}-auth-code-input`).fill("");
|
|
87
|
+
await peer.getByTestId(`${type === "device" ? "halo" : "space"}-auth-code-input`).focus();
|
|
88
|
+
}
|
|
89
|
+
async resetInvitation(scope) {
|
|
90
|
+
await (scope || this.page).getByTestId("invitation-rescuer-reset").click();
|
|
91
|
+
}
|
|
92
|
+
async doneInvitation(type, scope) {
|
|
93
|
+
await (scope || this.page).getByTestId(type === "device" ? "halo-invitation-accepted-done" : "space-invitation-accepted-done").click();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// packages/sdk/shell/src/testing/shell-manager.ts
|
|
98
|
+
import { sleep, Trigger } from "@dxos/async";
|
|
99
|
+
var ShellManager = class extends ScopedShellManager {
|
|
100
|
+
// prettier-ignore
|
|
101
|
+
constructor(page, inIFrame = true) {
|
|
102
|
+
super();
|
|
103
|
+
this.page = page;
|
|
104
|
+
this.inIFrame = inIFrame;
|
|
105
|
+
this._invitationCode = new Trigger();
|
|
106
|
+
this._authCode = new Trigger();
|
|
107
|
+
this.page.on("console", (message) => this._onConsoleMessage(message));
|
|
108
|
+
}
|
|
109
|
+
get shell() {
|
|
110
|
+
return this.inIFrame ? this.page.frameLocator("data-testid=dxos-shell") : this.page;
|
|
111
|
+
}
|
|
112
|
+
// Getters
|
|
113
|
+
async isCurrentSpaceViewVisible() {
|
|
114
|
+
return await this.shell.getByTestId("current-space-view").isVisible();
|
|
115
|
+
}
|
|
116
|
+
async isSpaceListViewVisible() {
|
|
117
|
+
return await this.shell.getByTestId("space-list-view").isVisible();
|
|
118
|
+
}
|
|
119
|
+
// Actions
|
|
120
|
+
async createIdentity(name) {
|
|
121
|
+
await this.shell.getByTestId("create-identity").click();
|
|
122
|
+
await this.page.keyboard.type(name);
|
|
123
|
+
await this.shell.getByTestId("create-identity-input-continue").click();
|
|
124
|
+
await this.shell.getByTestId("halo-invitation-accepted-done").click();
|
|
125
|
+
}
|
|
126
|
+
async closeShell() {
|
|
127
|
+
await this.page.keyboard.press("Escape");
|
|
128
|
+
}
|
|
129
|
+
// TODO(wittjosiah): These shortcuts are no longer within the SDK so these commands should live elsewhere.
|
|
130
|
+
async openCurrentSpace() {
|
|
131
|
+
await this.page.keyboard.press("Meta+.");
|
|
132
|
+
}
|
|
133
|
+
async openSpaceList() {
|
|
134
|
+
await this.page.keyboard.press("Meta+Shift+>");
|
|
135
|
+
}
|
|
136
|
+
async showAllSpaces() {
|
|
137
|
+
await this.shell.getByTestId("show-all-spaces").click();
|
|
138
|
+
}
|
|
139
|
+
async showCurrentSpace() {
|
|
140
|
+
await this.shell.getByTestId("show-current-space").click();
|
|
141
|
+
}
|
|
142
|
+
async createSpaceInvitation() {
|
|
143
|
+
await this.openCurrentSpace();
|
|
144
|
+
this._invitationCode = new Trigger();
|
|
145
|
+
this._authCode = new Trigger();
|
|
146
|
+
await this.shell.getByTestId("spaces-panel.create-invitation").click();
|
|
147
|
+
return await this._invitationCode.wait();
|
|
148
|
+
}
|
|
149
|
+
async acceptSpaceInvitation(invitationCode) {
|
|
150
|
+
await this.inputInvitation("space", invitationCode, this.shell);
|
|
151
|
+
}
|
|
152
|
+
async getAuthCode() {
|
|
153
|
+
return await this._authCode.wait();
|
|
154
|
+
}
|
|
155
|
+
async authenticate(authCode) {
|
|
156
|
+
await sleep(1500);
|
|
157
|
+
await this.authenticateInvitation("space", authCode, this.shell);
|
|
158
|
+
await this.doneInvitation("space", this.shell);
|
|
159
|
+
}
|
|
160
|
+
async _onConsoleMessage(message) {
|
|
161
|
+
try {
|
|
162
|
+
const json = JSON.parse(message.text());
|
|
163
|
+
if (json.invitationCode) {
|
|
164
|
+
this._invitationCode.wake(json.invitationCode);
|
|
165
|
+
}
|
|
166
|
+
if (json.authCode) {
|
|
167
|
+
this._authCode.wake(json.authCode);
|
|
168
|
+
}
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
export {
|
|
174
|
+
ScopedShellManager,
|
|
175
|
+
ShellManager,
|
|
176
|
+
alice,
|
|
177
|
+
inviteWithState
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/testing/fixtures/identities.ts", "../../../../src/testing/fixtures/invitations.ts", "../../../../src/testing/scoped-shell-manager.ts", "../../../../src/testing/shell-manager.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { SpaceMember } from '@dxos/react-client/echo';\n\nexport const alice: SpaceMember = {\n identity: {\n identityKey: PublicKey.random(),\n profile: {\n displayName: 'Alice',\n },\n },\n presence: SpaceMember.PresenceState.ONLINE,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { Invitation, CancellableInvitationObservable } from '@dxos/react-client/invitations';\n\nexport const inviteWithState = (state: Invitation.State) =>\n new CancellableInvitationObservable({\n initialInvitation: {\n state,\n invitationId: Math.random().toString(16).slice(2),\n kind: Invitation.Kind.SPACE,\n authMethod: Invitation.AuthMethod.NONE,\n swarmKey: PublicKey.random(),\n type: Invitation.Type.INTERACTIVE,\n authCode: [Invitation.State.READY_FOR_AUTHENTICATION, Invitation.State.AUTHENTICATING].includes(state)\n ? '123456'\n : '',\n },\n subscriber: () => {},\n onCancel: async () => {},\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Locator, Page, FrameLocator } from '@playwright/test';\n\ntype Scope = Locator | FrameLocator | Page;\n\nexport class ScopedShellManager {\n page!: Page;\n\n authenticatorIsVisible(type: 'device' | 'space', scope?: Scope) {\n return (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).isVisible();\n }\n\n async invitationFailed(scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer.locator('[data-testid=invitation-rescuer-reset]:not([disabled])').waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async inputInvitation(type: 'device' | 'space', invitation: string, scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input`).fill(invitation);\n await this.page.keyboard.press('Enter');\n }\n\n async invitationInputContinue(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input-continue`).click();\n }\n\n async cancelInvitation(type: 'device' | 'space', kind: 'host' | 'guest', scope?: Scope) {\n if (kind === 'guest') {\n await (scope || this.page)\n .getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-cancel`)\n .click();\n } else {\n await (scope || this.page).getByTestId('cancel-invitation').nth(0).click();\n }\n }\n\n async readyToAuthenticate(type: 'device' | 'space', scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer\n .locator(`[data-testid=${type === 'device' ? 'halo' : 'space'}-auth-code-input]:not([disabled])`)\n .waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async authenticateInvitation(type: 'device' | 'space', authCode: string, scope?: Scope) {\n const peer = scope || this.page;\n // TODO(wittjosiah): Update ids.\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill(authCode);\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-next`).click();\n }\n\n async clearAuthCode(type: 'device' | 'space', scope?: Scope) {\n const peer = scope || this.page;\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill('');\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).focus();\n }\n\n async resetInvitation(scope?: Scope) {\n await (scope || this.page).getByTestId('invitation-rescuer-reset').click();\n }\n\n async doneInvitation(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page)\n .getByTestId(type === 'device' ? 'halo-invitation-accepted-done' : 'space-invitation-accepted-done')\n .click();\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { ConsoleMessage, Page } from '@playwright/test';\n\nimport { sleep, Trigger } from '@dxos/async';\n\nimport { ScopedShellManager } from './scoped-shell-manager';\n\nexport class ShellManager extends ScopedShellManager {\n private _invitationCode = new Trigger<string>();\n private _authCode = new Trigger<string>();\n\n // prettier-ignore\n constructor(\n override readonly page: Page,\n readonly inIFrame = true,\n ) {\n super();\n this.page.on('console', (message) => this._onConsoleMessage(message));\n }\n\n get shell() {\n return this.inIFrame ? this.page.frameLocator('data-testid=dxos-shell') : this.page;\n }\n\n // Getters\n\n async isCurrentSpaceViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('current-space-view').isVisible();\n }\n\n async isSpaceListViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('space-list-view').isVisible();\n }\n\n // Actions\n\n async createIdentity(name: string) {\n await this.shell.getByTestId('create-identity').click();\n await this.page.keyboard.type(name);\n await this.shell.getByTestId('create-identity-input-continue').click();\n await this.shell.getByTestId('halo-invitation-accepted-done').click();\n }\n\n async closeShell() {\n await this.page.keyboard.press('Escape');\n }\n\n // TODO(wittjosiah): These shortcuts are no longer within the SDK so these commands should live elsewhere.\n async openCurrentSpace() {\n await this.page.keyboard.press('Meta+.');\n }\n\n async openSpaceList() {\n await this.page.keyboard.press('Meta+Shift+>');\n }\n\n async showAllSpaces() {\n await this.shell.getByTestId('show-all-spaces').click();\n }\n\n async showCurrentSpace() {\n await this.shell.getByTestId('show-current-space').click();\n }\n\n async createSpaceInvitation(): Promise<string> {\n await this.openCurrentSpace();\n this._invitationCode = new Trigger<string>();\n this._authCode = new Trigger<string>();\n await this.shell.getByTestId('spaces-panel.create-invitation').click();\n return await this._invitationCode.wait();\n }\n\n async acceptSpaceInvitation(invitationCode: string) {\n await this.inputInvitation('space', invitationCode, this.shell);\n }\n\n async getAuthCode(): Promise<string> {\n return await this._authCode.wait();\n }\n\n async authenticate(authCode: string) {\n // Wait for focus to shift before typing.\n await sleep(1500);\n await this.authenticateInvitation('space', authCode, this.shell);\n await this.doneInvitation('space', this.shell);\n }\n\n private async _onConsoleMessage(message: ConsoleMessage) {\n try {\n const json = JSON.parse(message.text());\n if (json.invitationCode) {\n this._invitationCode.wake(json.invitationCode);\n }\n if (json.authCode) {\n this._authCode.wake(json.authCode);\n }\n } catch {}\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,iBAAiB;AAC1B,SAASC,mBAAmB;AAErB,IAAMC,QAAqB;EAChCC,UAAU;IACRC,aAAaC,UAAUC,OAAM;IAC7BC,SAAS;MACPC,aAAa;IACf;EACF;EACAC,UAAUC,YAAYC,cAAcC;AACtC;;;ACXA,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,YAAYC,uCAAuC;AAErD,IAAMC,kBAAkB,CAACC,UAC9B,IAAIC,gCAAgC;EAClCC,mBAAmB;IACjBF;IACAG,cAAcC,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,MAAM,CAAA;IAC/CC,MAAMC,WAAWC,KAAKC;IACtBC,YAAYH,WAAWI,WAAWC;IAClCC,UAAUC,WAAUX,OAAM;IAC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AClC;EAEA,MAAMK,aAAaC,UAAkB;AAEnC,UAAMC,MAAM,IAAA;AACZ,UAAM,KAAKC,uBAAuB,SAASF,UAAU,KAAKxB,KAAK;AAC/D,UAAM,KAAK2B,eAAe,SAAS,KAAK3B,KAAK;EAC/C;EAEA,MAAcD,kBAAkBD,SAAyB;AACvD,QAAI;AACF,YAAM8B,OAAOC,KAAKC,MAAMhC,QAAQiC,KAAI,CAAA;AACpC,UAAIH,KAAKR,gBAAgB;AACvB,aAAK1B,gBAAgBsC,KAAKJ,KAAKR,cAAc;MAC/C;AACA,UAAIQ,KAAKJ,UAAU;AACjB,aAAK5B,UAAUoC,KAAKJ,KAAKJ,QAAQ;MACnC;IACF,QAAQ;IAAC;EACX;AACF;",
|
|
6
|
+
"names": ["PublicKey", "SpaceMember", "alice", "identity", "identityKey", "PublicKey", "random", "profile", "displayName", "presence", "SpaceMember", "PresenceState", "ONLINE", "PublicKey", "Invitation", "CancellableInvitationObservable", "inviteWithState", "state", "CancellableInvitationObservable", "initialInvitation", "invitationId", "Math", "random", "toString", "slice", "kind", "Invitation", "Kind", "SPACE", "authMethod", "AuthMethod", "NONE", "swarmKey", "PublicKey", "type", "Type", "INTERACTIVE", "authCode", "State", "READY_FOR_AUTHENTICATION", "AUTHENTICATING", "includes", "subscriber", "onCancel", "ScopedShellManager", "authenticatorIsVisible", "type", "scope", "page", "getByTestId", "isVisible", "invitationFailed", "timeout", "peer", "locator", "waitFor", "inputInvitation", "invitation", "fill", "keyboard", "press", "invitationInputContinue", "click", "cancelInvitation", "kind", "nth", "readyToAuthenticate", "authenticateInvitation", "authCode", "clearAuthCode", "focus", "resetInvitation", "doneInvitation", "sleep", "Trigger", "ShellManager", "ScopedShellManager", "constructor", "page", "inIFrame", "_invitationCode", "Trigger", "_authCode", "on", "message", "_onConsoleMessage", "shell", "frameLocator", "isCurrentSpaceViewVisible", "getByTestId", "isVisible", "isSpaceListViewVisible", "createIdentity", "name", "click", "keyboard", "type", "closeShell", "press", "openCurrentSpace", "openSpaceList", "showAllSpaces", "showCurrentSpace", "createSpaceInvitation", "wait", "acceptSpaceInvitation", "invitationCode", "inputInvitation", "getAuthCode", "authenticate", "authCode", "sleep", "authenticateInvitation", "doneInvitation", "json", "JSON", "parse", "text", "wake"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
+
export type AuthCodeProps = ThemedClassName<ComponentPropsWithoutRef<'span'>> & {
|
|
4
|
+
code?: string;
|
|
5
|
+
large?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const AuthCode: (props: PropsWithChildren<AuthCodeProps>) => JSX.Element;
|
|
8
|
+
//# sourceMappingURL=AuthCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthCode.d.ts","sourceRoot":"","sources":["../../../../src/components/AuthCode.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,wBAAwB,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,GAAG;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,kBAAkB,aAAa,CAAC,gBAqB/D,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2023 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AuthCode = void 0;
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const react_ui_theme_1 = require("@dxos/react-ui-theme");
|
|
12
|
+
const AuthCode = (props) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { code, large, classNames } = props;
|
|
15
|
+
const l = (_a = code === null || code === void 0 ? void 0 : code.length) !== null && _a !== void 0 ? _a : 0;
|
|
16
|
+
const left = code === null || code === void 0 ? void 0 : code.slice(0, l / 2);
|
|
17
|
+
const right = code === null || code === void 0 ? void 0 : code.slice(l / 2);
|
|
18
|
+
const handleCopy = () => {
|
|
19
|
+
void navigator.clipboard.writeText(code !== null && code !== void 0 ? code : '');
|
|
20
|
+
};
|
|
21
|
+
return (react_1.default.createElement("span", { className: (0, react_ui_theme_1.mx)(large ? 'text-6xl' : 'text-2xl', 'font-mono pli-2.5 flex gap-1.5 rounded cursor-pointer', classNames), onClick: handleCopy },
|
|
22
|
+
react_1.default.createElement("span", null, left),
|
|
23
|
+
react_1.default.createElement("span", null, right)));
|
|
24
|
+
};
|
|
25
|
+
exports.AuthCode = AuthCode;
|
|
26
|
+
//# sourceMappingURL=AuthCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthCode.js","sourceRoot":"","sources":["../../../../src/components/AuthCode.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kDAAqF;AAGrF,yDAA0C;AAOnC,MAAM,QAAQ,GAAG,CAAC,KAAuC,EAAE,EAAE;;IAClE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,CAAC,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,KAAK,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,OAAO,CACL,wCACE,SAAS,EAAE,IAAA,mBAAE,EACX,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAC/B,uDAAuD,EACvD,UAAU,CACX,EACD,OAAO,EAAE,UAAU;QAEnB,4CAAO,IAAI,CAAQ;QACnB,4CAAO,KAAK,CAAQ,CACf,CACR,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,QAAQ,YAqBnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
export type ClipboardContextValue = {
|
|
3
|
+
textValue: string;
|
|
4
|
+
setTextValue: (nextValue: string) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
export declare const ClipboardContext: React.Context<ClipboardContextValue>;
|
|
7
|
+
export declare const useClipboardContext: () => ClipboardContextValue;
|
|
8
|
+
export declare const ClipboardProvider: ({ children }: PropsWithChildren<{}>) => JSX.Element;
|
|
9
|
+
//# sourceMappingURL=ClipboardProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClipboardProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Clipboard/ClipboardProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAiB,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAExG,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,gBAAgB,sCAG3B,CAAC;AAEH,eAAO,MAAM,mBAAmB,6BAAqC,CAAC;AAEtE,eAAO,MAAM,iBAAiB,iBAAkB,kBAAkB,EAAE,CAAC,gBAOpE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2023 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ClipboardProvider = exports.useClipboardContext = exports.ClipboardContext = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
exports.ClipboardContext = (0, react_1.createContext)({
|
|
32
|
+
textValue: '',
|
|
33
|
+
setTextValue: async (_) => { },
|
|
34
|
+
});
|
|
35
|
+
const useClipboardContext = () => (0, react_1.useContext)(exports.ClipboardContext);
|
|
36
|
+
exports.useClipboardContext = useClipboardContext;
|
|
37
|
+
const ClipboardProvider = ({ children }) => {
|
|
38
|
+
const [textValue, setInternalTextValue] = (0, react_1.useState)('');
|
|
39
|
+
const setTextValue = (0, react_1.useCallback)(async (nextValue) => {
|
|
40
|
+
await navigator.clipboard.writeText(nextValue);
|
|
41
|
+
return setInternalTextValue(nextValue);
|
|
42
|
+
}, []);
|
|
43
|
+
return react_1.default.createElement(exports.ClipboardContext.Provider, { value: { textValue, setTextValue } }, children);
|
|
44
|
+
};
|
|
45
|
+
exports.ClipboardProvider = ClipboardProvider;
|
|
46
|
+
//# sourceMappingURL=ClipboardProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClipboardProvider.js","sourceRoot":"","sources":["../../../../../src/components/Clipboard/ClipboardProvider.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,+CAAwG;AAO3F,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAwB;IACnE,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAE,CAAC;CAC9B,CAAC,CAAC;AAEI,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,wBAAgB,CAAC,CAAC;AAAzD,QAAA,mBAAmB,uBAAsC;AAE/D,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAyB,EAAE,EAAE;IACvE,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,KAAK,EAAE,SAAiB,EAAE,EAAE;QAC3D,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC/C,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,8BAAC,wBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IAAG,QAAQ,CAA6B,CAAC;AAC/G,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IconProps } from '@phosphor-icons/react';
|
|
2
|
+
import { type ButtonProps } from '@dxos/react-ui';
|
|
3
|
+
export type CopyButtonProps = ButtonProps & {
|
|
4
|
+
value: string;
|
|
5
|
+
iconProps?: IconProps;
|
|
6
|
+
};
|
|
7
|
+
export declare const CopyButton: ({ value, classNames, iconProps, ...props }: CopyButtonProps) => JSX.Element;
|
|
8
|
+
export declare const CopyButtonIconOnly: ({ value, classNames, iconProps, variant, ...props }: CopyButtonProps) => JSX.Element;
|
|
9
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Clipboard/CopyButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGpE,OAAO,EAAU,KAAK,WAAW,EAA2B,MAAM,gBAAgB,CAAC;AAKnF,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAIF,eAAO,MAAM,UAAU,+CAAgD,eAAe,gBAqBrF,CAAC;AAEF,eAAO,MAAM,kBAAkB,wDAAyD,eAAe,gBA2BtG,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2023 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.CopyButtonIconOnly = exports.CopyButton = void 0;
|
|
30
|
+
const react_1 = require("@phosphor-icons/react");
|
|
31
|
+
const react_2 = __importStar(require("react"));
|
|
32
|
+
const react_ui_1 = require("@dxos/react-ui");
|
|
33
|
+
const react_ui_theme_1 = require("@dxos/react-ui-theme");
|
|
34
|
+
const ClipboardProvider_1 = require("./ClipboardProvider");
|
|
35
|
+
const inactiveLabelStyles = 'invisible bs-px -mbe-px overflow-hidden';
|
|
36
|
+
const CopyButton = ({ value, classNames, iconProps, ...props }) => {
|
|
37
|
+
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
38
|
+
const { textValue, setTextValue } = (0, ClipboardProvider_1.useClipboardContext)();
|
|
39
|
+
const isCopied = textValue === value;
|
|
40
|
+
return (react_2.default.createElement(react_ui_1.Button, { ...props, classNames: ['inline-flex flex-col justify-center', classNames], onClick: () => setTextValue(value), "data-testid": 'copy-invitation' },
|
|
41
|
+
react_2.default.createElement("div", { role: 'none', className: (0, react_ui_theme_1.mx)('flex gap-1 items-center', isCopied && inactiveLabelStyles) },
|
|
42
|
+
react_2.default.createElement("span", { className: 'pli-1' }, t('copy invitation code label')),
|
|
43
|
+
react_2.default.createElement(react_1.Copy, { className: (0, react_ui_theme_1.getSize)(4), weight: 'bold', ...iconProps })),
|
|
44
|
+
react_2.default.createElement("div", { role: 'none', className: (0, react_ui_theme_1.mx)('flex gap-1 items-center', !isCopied && inactiveLabelStyles) },
|
|
45
|
+
react_2.default.createElement("span", { className: 'pli-1' }, t('copy invitation code success label')),
|
|
46
|
+
react_2.default.createElement(react_1.Check, { className: (0, react_ui_theme_1.getSize)(4), weight: 'bold', ...iconProps }))));
|
|
47
|
+
};
|
|
48
|
+
exports.CopyButton = CopyButton;
|
|
49
|
+
const CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) => {
|
|
50
|
+
const { t } = (0, react_ui_1.useTranslation)('os');
|
|
51
|
+
const { textValue, setTextValue } = (0, ClipboardProvider_1.useClipboardContext)();
|
|
52
|
+
const isCopied = textValue === value;
|
|
53
|
+
const label = isCopied ? t('copy invitation code success label') : t('copy invitation code label');
|
|
54
|
+
const [open, setOpen] = (0, react_2.useState)(false);
|
|
55
|
+
return (react_2.default.createElement(react_ui_1.Tooltip.Root, { delayDuration: 1500, open: open, onOpenChange: setOpen },
|
|
56
|
+
react_2.default.createElement(react_ui_1.Tooltip.Portal, null,
|
|
57
|
+
react_2.default.createElement(react_ui_1.Tooltip.Content, { side: 'bottom', sideOffset: 12, classNames: 'z-30' },
|
|
58
|
+
react_2.default.createElement("span", null, label),
|
|
59
|
+
react_2.default.createElement(react_ui_1.Tooltip.Arrow, null))),
|
|
60
|
+
react_2.default.createElement(react_ui_1.Tooltip.Trigger, { "aria-label": label, ...props, onClick: () => setTextValue(value).then(() => setOpen(true)), "data-testid": 'copy-invitation', asChild: true },
|
|
61
|
+
react_2.default.createElement(react_ui_1.Button, { variant: variant, classNames: ['inline-flex flex-col justify-center', classNames] },
|
|
62
|
+
react_2.default.createElement(react_1.Copy, { className: (0, react_ui_theme_1.getSize)(5), weight: 'bold', ...iconProps })))));
|
|
63
|
+
};
|
|
64
|
+
exports.CopyButtonIconOnly = CopyButtonIconOnly;
|
|
65
|
+
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../../../../src/components/Clipboard/CopyButton.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,iDAAoE;AACpE,+CAAwC;AAExC,6CAAmF;AACnF,yDAAmD;AAEnD,2DAA0D;AAO1D,MAAM,mBAAmB,GAAG,yCAAyC,CAAC;AAE/D,MAAM,UAAU,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACxF,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAmB,GAAE,CAAC;IAC1D,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC;IACrC,OAAO,CACL,8BAAC,iBAAM,OACD,KAAK,EACT,UAAU,EAAE,CAAC,qCAAqC,EAAE,UAAU,CAAC,EAC/D,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AAQ,EAAC,KAAK,CAAC,CAAC;IACxC,OAAO,CACL,8BAAC,kBAAO,CAAC,IAAI,IAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO;QAClE,8BAAC,kBAAO,CAAC,MAAM;YACb,8BAAC,kBAAO,CAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,EAAC,UAAU,EAAE,EAAE,EAAE,UAAU,EAAC,MAAM;gBAC9D,4CAAO,KAAK,CAAQ;gBACpB,8BAAC,kBAAO,CAAC,KAAK,OAAG,CACD,CACH;QACjB,8BAAC,kBAAO,CAAC,OAAO,kBACF,KAAK,KACb,KAAK,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,iBAChD,iBAAiB,EAC7B,OAAO;YAEP,8BAAC,iBAAM,IAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,qCAAqC,EAAE,UAAU,CAAC;gBACvF,8BAAC,YAAI,IAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,EAAE,MAAM,EAAC,MAAM,KAAK,SAAS,GAAI,CACrD,CACO,CACL,CAChB,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,kBAAkB,sBA2B7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Clipboard/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2023 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./CopyButton"), exports);
|
|
21
|
+
__exportStar(require("./ClipboardProvider"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/Clipboard/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,+CAA6B;AAC7B,sDAAoC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
import { type ButtonProps } from '@dxos/react-ui';
|
|
3
|
+
export interface CompoundButtonSlots {
|
|
4
|
+
root: ComponentPropsWithoutRef<'button'>;
|
|
5
|
+
middle: ComponentPropsWithoutRef<'div'>;
|
|
6
|
+
label: ComponentPropsWithoutRef<'p'>;
|
|
7
|
+
description: ComponentPropsWithoutRef<'p'>;
|
|
8
|
+
}
|
|
9
|
+
export interface CompoundButtonProps extends ButtonProps {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
before?: ReactNode;
|
|
13
|
+
after?: ReactNode;
|
|
14
|
+
slots?: Partial<CompoundButtonSlots>;
|
|
15
|
+
}
|
|
16
|
+
export declare const CompoundButton: ({ children, description, before, after, variant, elevation: propsElevation, slots, ...buttonProps }: Omit<CompoundButtonProps, 'density'>) => JSX.Element;
|
|
17
|
+
//# sourceMappingURL=CompoundButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompoundButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":"AAIA,OAAc,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,EAA0B,KAAK,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAG/F,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACxC,KAAK,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAC;IACrC,WAAW,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,cAAc,wGASxB,KAAK,mBAAmB,EAAE,SAAS,CAAC,gBAuDtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CompoundButton = void 0;
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const react_ui_1 = require("@dxos/react-ui");
|
|
12
|
+
const react_ui_theme_1 = require("@dxos/react-ui-theme");
|
|
13
|
+
const CompoundButton = ({ children, description, before, after, variant = 'default', elevation: propsElevation, slots = {}, ...buttonProps }) => {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const labelId = (0, react_ui_1.useId)('compoundButton-label');
|
|
16
|
+
const descriptionId = (0, react_ui_1.useId)('compoundButton-description');
|
|
17
|
+
const { tx } = (0, react_ui_1.useThemeContext)();
|
|
18
|
+
const elevation = (0, react_ui_1.useElevationContext)(propsElevation);
|
|
19
|
+
const styleProps = { ...buttonProps, variant, elevation, textWrap: true };
|
|
20
|
+
const buttonClassName = tx('button.root', 'button button--compound', styleProps, 'flex items-center gap-4 plb-2.5', (_a = slots.root) === null || _a === void 0 ? void 0 : _a.className);
|
|
21
|
+
return (react_1.default.createElement("button", { ...buttonProps, ...slots.root, className: buttonClassName, "aria-labelledby": labelId, ...(description && { 'aria-describedby': descriptionId }) },
|
|
22
|
+
before && (react_1.default.createElement("div", { role: 'none', className: 'grow-0' }, before)),
|
|
23
|
+
react_1.default.createElement("div", { role: 'none', ...slots.middle, className: (0, react_ui_theme_1.mx)('grow whitespace-normal flex flex-col gap-1 text-left', (_b = slots.middle) === null || _b === void 0 ? void 0 : _b.className) },
|
|
24
|
+
react_1.default.createElement("p", { ...slots.label, id: labelId, className: (0, react_ui_theme_1.mx)((_c = slots.label) === null || _c === void 0 ? void 0 : _c.className) }, children),
|
|
25
|
+
description && (react_1.default.createElement("p", { id: descriptionId, ...slots.description, className: (0, react_ui_theme_1.mx)('text-xs mbe-1 font-normal', variant === 'primary' ? react_ui_theme_1.descriptionTextPrimary : react_ui_theme_1.descriptionText, (_d = slots.description) === null || _d === void 0 ? void 0 : _d.className) }, description))),
|
|
26
|
+
after && (react_1.default.createElement("div", { role: 'none', className: 'grow-0' }, after))));
|
|
27
|
+
};
|
|
28
|
+
exports.CompoundButton = CompoundButton;
|
|
29
|
+
//# sourceMappingURL=CompoundButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompoundButton.js","sourceRoot":"","sources":["../../../../../src/components/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kDAA6E;AAE7E,6CAA+F;AAC/F,yDAAmF;AAiB5E,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,EACL,OAAO,GAAG,SAAS,EACnB,SAAS,EAAE,cAAc,EACzB,KAAK,GAAG,EAAE,EACV,GAAG,WAAW,EACuB,EAAE,EAAE;;IACzC,MAAM,OAAO,GAAG,IAAA,gBAAK,EAAC,sBAAsB,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAA,gBAAK,EAAC,4BAA4B,CAAC,CAAC;IAC1D,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,0BAAe,GAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAA,8BAAmB,EAAC,cAAc,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1E,MAAM,eAAe,GAAG,EAAE,CACxB,aAAa,EACb,yBAAyB,EACzB,UAAU,EACV,iCAAiC,EACjC,MAAA,KAAK,CAAC,IAAI,0CAAE,SAAS,CACtB,CAAC;IACF,OAAO,CACL,6CACM,WAAW,KACX,KAAK,CAAC,IAAI,EACd,SAAS,EAAE,eAAe,qBACT,OAAO,KACpB,CAAC,WAAW,IAAI,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;QAEzD,MAAM,IAAI,CACT,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,IAChC,MAAM,CACH,CACP;QACD,uCACE,IAAI,EAAC,MAAM,KACP,KAAK,CAAC,MAAM,EAChB,SAAS,EAAE,IAAA,mBAAE,EAAC,sDAAsD,EAAE,MAAA,KAAK,CAAC,MAAM,0CAAE,SAAS,CAAC;YAE9F,wCAAO,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAA,mBAAE,EAAC,MAAA,KAAK,CAAC,KAAK,0CAAE,SAAS,CAAC,IACnE,QAAQ,CACP;YACH,WAAW,IAAI,CACd,qCACE,EAAE,EAAE,aAAa,KACb,KAAK,CAAC,WAAW,EACrB,SAAS,EAAE,IAAA,mBAAE,EACX,2BAA2B,EAC3B,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,uCAAsB,CAAC,CAAC,CAAC,gCAAe,EAChE,MAAA,KAAK,CAAC,WAAW,0CAAE,SAAS,CAC7B,IAEA,WAAW,CACV,CACL,CACG;QACL,KAAK,IAAI,CACR,uCAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,IAChC,KAAK,CACF,CACP,CACM,CACV,CAAC;AACJ,CAAC,CAAC;AAhEW,QAAA,cAAc,kBAgEzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import '@dxosTheme';
|
|
2
|
+
import { type CompoundButtonProps } from './CompoundButton';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ children, description, before, after, variant, elevation: propsElevation, slots, ...buttonProps }: Omit<CompoundButtonProps, "density">) => JSX.Element;
|
|
6
|
+
decorators: import("@storybook/react").Decorator[];
|
|
7
|
+
parameters: {
|
|
8
|
+
chromatic: {
|
|
9
|
+
disableSnapshot: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const Default: {
|
|
15
|
+
render: (args: Omit<CompoundButtonProps, 'ref'>) => JSX.Element;
|
|
16
|
+
args: {
|
|
17
|
+
children: string;
|
|
18
|
+
description: string;
|
|
19
|
+
before: JSX.Element;
|
|
20
|
+
after: JSX.Element;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const Primary: {
|
|
25
|
+
args: {
|
|
26
|
+
children: string;
|
|
27
|
+
description: string;
|
|
28
|
+
before: JSX.Element;
|
|
29
|
+
after: JSX.Element;
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
variant: string;
|
|
32
|
+
};
|
|
33
|
+
render: (args: Omit<CompoundButtonProps, 'ref'>) => JSX.Element;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=CompoundButton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompoundButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/CompoundButton/CompoundButton.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAOpB,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;;;;;;;;;;;AAE5E,wBAKE;AAIF,eAAO,MAAM,OAAO;mBACH,KAAK,mBAAmB,EAAE,KAAK,CAAC;;;;;;;;CAahD,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;mBAfH,KAAK,mBAAmB,EAAE,KAAK,CAAC;CAyBhD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2022 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Primary = exports.Default = void 0;
|
|
10
|
+
require("@dxosTheme");
|
|
11
|
+
const react_1 = require("@phosphor-icons/react");
|
|
12
|
+
const react_2 = __importDefault(require("react"));
|
|
13
|
+
const storybook_utils_1 = require("@dxos/storybook-utils");
|
|
14
|
+
const CompoundButton_1 = require("./CompoundButton");
|
|
15
|
+
exports.default = {
|
|
16
|
+
title: 'react-shell/CompoundButton',
|
|
17
|
+
component: CompoundButton_1.CompoundButton,
|
|
18
|
+
decorators: [storybook_utils_1.withTheme],
|
|
19
|
+
parameters: { chromatic: { disableSnapshot: false } },
|
|
20
|
+
};
|
|
21
|
+
const Container = ({ children }) => react_2.default.createElement("div", { className: 'flex gap-4' }, children);
|
|
22
|
+
exports.Default = {
|
|
23
|
+
render: (args) => (react_2.default.createElement(Container, null,
|
|
24
|
+
react_2.default.createElement(CompoundButton_1.CompoundButton, { ...args }),
|
|
25
|
+
react_2.default.createElement(CompoundButton_1.CompoundButton, { ...args, disabled: true }))),
|
|
26
|
+
args: {
|
|
27
|
+
children: 'Hello',
|
|
28
|
+
description: 'This is a compound button',
|
|
29
|
+
before: react_2.default.createElement(react_1.ClockCounterClockwise, { className: 'w-5 h-5' }),
|
|
30
|
+
after: react_2.default.createElement(react_1.ArrowRight, { className: 'w-5 h-5' }),
|
|
31
|
+
disabled: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
exports.Primary = {
|
|
35
|
+
...exports.Default,
|
|
36
|
+
args: {
|
|
37
|
+
children: 'Hello',
|
|
38
|
+
description: 'This is a compound button',
|
|
39
|
+
before: react_2.default.createElement(react_1.ClockCounterClockwise, { className: 'w-5 h-5' }),
|
|
40
|
+
after: react_2.default.createElement(react_1.ArrowRight, { className: 'w-5 h-5' }),
|
|
41
|
+
disabled: false,
|
|
42
|
+
variant: 'primary',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=CompoundButton.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompoundButton.stories.js","sourceRoot":"","sources":["../../../../../src/components/CompoundButton/CompoundButton.stories.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA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