@dxos/react-ui 0.1.20 → 0.1.22
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 +13 -137
- package/dist/lib/browser/index.mjs +160 -2022
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts +6 -0
- package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts.map +1 -0
- package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts +20 -0
- package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts +9 -0
- package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts.map +1 -0
- package/dist/types/src/composites/IdentityPopover/index.d.ts +2 -0
- package/dist/types/src/composites/IdentityPopover/index.d.ts.map +1 -0
- package/dist/types/src/composites/index.d.ts +2 -0
- package/dist/types/src/composites/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts +11 -0
- package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts.map +1 -0
- package/dist/types/src/layouts/PanelPopover/index.d.ts +2 -0
- package/dist/types/src/layouts/PanelPopover/index.d.ts.map +1 -0
- package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts +20 -0
- package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts.map +1 -0
- package/dist/types/src/layouts/PanelSidebar/index.d.ts +2 -0
- package/dist/types/src/layouts/PanelSidebar/index.d.ts.map +1 -0
- package/dist/types/src/layouts/index.d.ts +3 -0
- package/dist/types/src/layouts/index.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +6 -0
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts +2 -0
- package/dist/types/src/panels/IdentityPanel/index.d.ts.map +1 -0
- package/dist/types/src/panels/index.d.ts +2 -0
- package/dist/types/src/panels/index.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +1 -11
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/styles/panelStyles.d.ts +3 -0
- package/dist/types/src/styles/panelStyles.d.ts.map +1 -0
- package/dist/types/src/testing/ClientProvider.d.ts +3 -0
- package/dist/types/src/testing/ClientProvider.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- 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/locales/en-US.d.ts +6 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -0
- package/package.json +16 -32
- package/src/components/IdentityListItem/IdentityListItem.stories.tsx +23 -0
- package/src/components/IdentityListItem/IdentityListItem.tsx +32 -0
- package/src/composites/IdentityPopover/IdentityPopover.tsx +54 -0
- package/src/composites/IdentityPopover/index.ts +5 -0
- package/src/composites/index.ts +4 -0
- package/src/index.ts +4 -4
- package/src/layouts/PanelPopover/PanelPopover.tsx +40 -0
- package/src/layouts/PanelPopover/index.ts +5 -0
- package/src/layouts/PanelSidebar/PanelSidebar.tsx +126 -0
- package/src/layouts/PanelSidebar/index.ts +5 -0
- package/src/layouts/index.ts +6 -0
- package/src/panels/IdentityPanel/IdentityPanel.tsx +39 -0
- package/src/panels/IdentityPanel/index.ts +5 -0
- package/src/panels/index.ts +5 -0
- package/src/styles/index.ts +2 -12
- package/src/styles/panelStyles.ts +6 -0
- package/src/testing/ClientProvider.tsx +18 -0
- package/src/testing/index.ts +1 -1
- package/src/translations/index.ts +7 -0
- package/src/translations/locales/en-US.ts +9 -0
- package/dist/plugin/node/esbuild-plugin.cjs +0 -469
- package/dist/plugin/node/esbuild-plugin.cjs.map +0 -7
- package/dist/plugin/node/meta.json +0 -1
- package/dist/plugin/node/plugin.cjs +0 -460
- package/dist/plugin/node/plugin.cjs.map +0 -7
- package/dist/plugin/node/theme.css +0 -61
- package/dist/plugin/node/theme.css.map +0 -7
- package/dist/types/src/components/Alert/Alert.d.ts +0 -15
- package/dist/types/src/components/Alert/Alert.d.ts.map +0 -1
- package/dist/types/src/components/Alert/Alert.stories.d.ts +0 -9
- package/dist/types/src/components/Alert/Alert.stories.d.ts.map +0 -1
- package/dist/types/src/components/Alert/index.d.ts +0 -2
- package/dist/types/src/components/Alert/index.d.ts.map +0 -1
- package/dist/types/src/components/AlertDialog/AlertDialog.d.ts +0 -26
- package/dist/types/src/components/AlertDialog/AlertDialog.d.ts.map +0 -1
- package/dist/types/src/components/AlertDialog/AlertDialog.stories.d.ts +0 -9
- package/dist/types/src/components/AlertDialog/AlertDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AlertDialog/index.d.ts +0 -2
- package/dist/types/src/components/AlertDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/Avatar/Avatar.d.ts +0 -22
- package/dist/types/src/components/Avatar/Avatar.d.ts.map +0 -1
- package/dist/types/src/components/Avatar/Avatar.stories.d.ts +0 -12
- package/dist/types/src/components/Avatar/Avatar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Avatar/index.d.ts +0 -2
- package/dist/types/src/components/Avatar/index.d.ts.map +0 -1
- package/dist/types/src/components/Button/Button.d.ts +0 -4
- package/dist/types/src/components/Button/Button.d.ts.map +0 -1
- package/dist/types/src/components/Button/Button.stories.d.ts +0 -13
- package/dist/types/src/components/Button/Button.stories.d.ts.map +0 -1
- package/dist/types/src/components/Button/ButtonGroup.d.ts +0 -6
- package/dist/types/src/components/Button/ButtonGroup.d.ts.map +0 -1
- package/dist/types/src/components/Button/ButtonProps.d.ts +0 -7
- package/dist/types/src/components/Button/ButtonProps.d.ts.map +0 -1
- package/dist/types/src/components/Button/buttonStyles.d.ts +0 -6
- package/dist/types/src/components/Button/buttonStyles.d.ts.map +0 -1
- package/dist/types/src/components/Button/index.d.ts +0 -5
- package/dist/types/src/components/Button/index.d.ts.map +0 -1
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts +0 -10
- package/dist/types/src/components/CompoundButton/CompoundButton.d.ts.map +0 -1
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts +0 -10
- package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts.map +0 -1
- package/dist/types/src/components/CompoundButton/index.d.ts +0 -2
- package/dist/types/src/components/CompoundButton/index.d.ts.map +0 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +0 -26
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +0 -9
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialog/index.d.ts +0 -2
- package/dist/types/src/components/Dialog/index.d.ts.map +0 -1
- package/dist/types/src/components/Group/Group.d.ts +0 -10
- package/dist/types/src/components/Group/Group.d.ts.map +0 -1
- package/dist/types/src/components/Group/Group.stories.d.ts +0 -9
- package/dist/types/src/components/Group/Group.stories.d.ts.map +0 -1
- package/dist/types/src/components/Group/index.d.ts +0 -2
- package/dist/types/src/components/Group/index.d.ts.map +0 -1
- package/dist/types/src/components/Heading/Heading.d.ts +0 -266
- package/dist/types/src/components/Heading/Heading.d.ts.map +0 -1
- package/dist/types/src/components/Heading/Heading.stories.d.ts +0 -274
- package/dist/types/src/components/Heading/Heading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Heading/index.d.ts +0 -2
- package/dist/types/src/components/Heading/index.d.ts.map +0 -1
- package/dist/types/src/components/Input/BarePinInput.d.ts +0 -314
- package/dist/types/src/components/Input/BarePinInput.d.ts.map +0 -1
- package/dist/types/src/components/Input/BareTextInput.d.ts +0 -7
- package/dist/types/src/components/Input/BareTextInput.d.ts.map +0 -1
- package/dist/types/src/components/Input/BareTextareaInput.d.ts +0 -7
- package/dist/types/src/components/Input/BareTextareaInput.d.ts.map +0 -1
- package/dist/types/src/components/Input/Input.d.ts +0 -4
- package/dist/types/src/components/Input/Input.d.ts.map +0 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +0 -27
- package/dist/types/src/components/Input/Input.stories.d.ts.map +0 -1
- package/dist/types/src/components/Input/InputProps.d.ts +0 -37
- package/dist/types/src/components/Input/InputProps.d.ts.map +0 -1
- package/dist/types/src/components/Input/index.d.ts +0 -2
- package/dist/types/src/components/Input/index.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.d.ts +0 -15
- package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -23
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
- package/dist/types/src/components/Loading/index.d.ts +0 -2
- package/dist/types/src/components/Loading/index.d.ts.map +0 -1
- package/dist/types/src/components/NavMenu/NavMenu.d.ts +0 -39
- package/dist/types/src/components/NavMenu/NavMenu.d.ts.map +0 -1
- package/dist/types/src/components/NavMenu/NavMenu.stories.d.ts +0 -9
- package/dist/types/src/components/NavMenu/NavMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/NavMenu/index.d.ts +0 -2
- package/dist/types/src/components/NavMenu/index.d.ts.map +0 -1
- package/dist/types/src/components/Popover/Popover.d.ts +0 -21
- package/dist/types/src/components/Popover/Popover.d.ts.map +0 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +0 -10
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +0 -1
- package/dist/types/src/components/Popover/index.d.ts +0 -2
- package/dist/types/src/components/Popover/index.d.ts.map +0 -1
- package/dist/types/src/components/QrCode/QrCode.d.ts +0 -39
- package/dist/types/src/components/QrCode/QrCode.d.ts.map +0 -1
- package/dist/types/src/components/QrCode/QrCode.stories.d.ts +0 -10
- package/dist/types/src/components/QrCode/QrCode.stories.d.ts.map +0 -1
- package/dist/types/src/components/QrCode/index.d.ts +0 -2
- package/dist/types/src/components/QrCode/index.d.ts.map +0 -1
- package/dist/types/src/components/Tag/Tag.d.ts +0 -8
- package/dist/types/src/components/Tag/Tag.d.ts.map +0 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +0 -10
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +0 -1
- package/dist/types/src/components/Tag/index.d.ts +0 -2
- package/dist/types/src/components/Tag/index.d.ts.map +0 -1
- package/dist/types/src/components/Toast/Toast.d.ts +0 -25
- package/dist/types/src/components/Toast/Toast.d.ts.map +0 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +0 -9
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toast/index.d.ts +0 -2
- package/dist/types/src/components/Toast/index.d.ts.map +0 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +0 -19
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +0 -9
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +0 -1
- package/dist/types/src/components/Tooltip/index.d.ts +0 -2
- package/dist/types/src/components/Tooltip/index.d.ts.map +0 -1
- package/dist/types/src/components/UiProvider/UiProvider.d.ts +0 -10
- package/dist/types/src/components/UiProvider/UiProvider.d.ts.map +0 -1
- package/dist/types/src/components/UiProvider/index.d.ts +0 -2
- package/dist/types/src/components/UiProvider/index.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -18
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/config/index.d.ts +0 -2
- package/dist/types/src/config/index.d.ts.map +0 -1
- package/dist/types/src/config/tailwind.d.ts +0 -7
- package/dist/types/src/config/tailwind.d.ts.map +0 -1
- package/dist/types/src/esbuild-plugin.d.ts +0 -6
- package/dist/types/src/esbuild-plugin.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -4
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useForwardedRef.d.ts +0 -2
- package/dist/types/src/hooks/useForwardedRef.d.ts.map +0 -1
- package/dist/types/src/hooks/useId.d.ts +0 -3
- package/dist/types/src/hooks/useId.d.ts.map +0 -1
- package/dist/types/src/hooks/useIsFocused.d.ts +0 -3
- package/dist/types/src/hooks/useIsFocused.d.ts.map +0 -1
- package/dist/types/src/plugin.d.ts +0 -9
- package/dist/types/src/plugin.d.ts.map +0 -1
- package/dist/types/src/props/Elevation.d.ts +0 -2
- package/dist/types/src/props/Elevation.d.ts.map +0 -1
- package/dist/types/src/props/MessageValence.d.ts +0 -2
- package/dist/types/src/props/MessageValence.d.ts.map +0 -1
- package/dist/types/src/props/Size.d.ts +0 -2
- package/dist/types/src/props/Size.d.ts.map +0 -1
- package/dist/types/src/props/index.d.ts +0 -4
- package/dist/types/src/props/index.d.ts.map +0 -1
- package/dist/types/src/styles/active.d.ts +0 -2
- package/dist/types/src/styles/active.d.ts.map +0 -1
- package/dist/types/src/styles/disabled.d.ts +0 -2
- package/dist/types/src/styles/disabled.d.ts.map +0 -1
- package/dist/types/src/styles/focus.d.ts +0 -3
- package/dist/types/src/styles/focus.d.ts.map +0 -1
- package/dist/types/src/styles/group.d.ts +0 -7
- package/dist/types/src/styles/group.d.ts.map +0 -1
- package/dist/types/src/styles/hover.d.ts +0 -4
- package/dist/types/src/styles/hover.d.ts.map +0 -1
- package/dist/types/src/styles/input.d.ts +0 -11
- package/dist/types/src/styles/input.d.ts.map +0 -1
- package/dist/types/src/styles/ornament.d.ts +0 -3
- package/dist/types/src/styles/ornament.d.ts.map +0 -1
- package/dist/types/src/styles/shimmer.d.ts +0 -3
- package/dist/types/src/styles/shimmer.d.ts.map +0 -1
- package/dist/types/src/styles/size.d.ts +0 -7
- package/dist/types/src/styles/size.d.ts.map +0 -1
- package/dist/types/src/styles/text.d.ts +0 -5
- package/dist/types/src/styles/text.d.ts.map +0 -1
- package/dist/types/src/styles/valence.d.ts +0 -19
- package/dist/types/src/styles/valence.d.ts.map +0 -1
- package/dist/types/src/testing/templateForComponent.d.ts +0 -4
- package/dist/types/src/testing/templateForComponent.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -2
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/mx.d.ts +0 -2
- package/dist/types/src/util/mx.d.ts.map +0 -1
- package/dist/types/src/util/withLogical.d.ts +0 -3
- package/dist/types/src/util/withLogical.d.ts.map +0 -1
- package/plugin.d.ts +0 -5
- package/plugin.js +0 -8
- package/src/components/Alert/Alert.stories.tsx +0 -31
- package/src/components/Alert/Alert.tsx +0 -40
- package/src/components/Alert/index.ts +0 -5
- package/src/components/AlertDialog/AlertDialog.stories.tsx +0 -35
- package/src/components/AlertDialog/AlertDialog.tsx +0 -147
- package/src/components/AlertDialog/index.ts +0 -5
- package/src/components/Avatar/Avatar.stories.tsx +0 -29
- package/src/components/Avatar/Avatar.tsx +0 -104
- package/src/components/Avatar/index.ts +0 -5
- package/src/components/Button/Button.stories.tsx +0 -45
- package/src/components/Button/Button.tsx +0 -20
- package/src/components/Button/ButtonGroup.tsx +0 -23
- package/src/components/Button/ButtonProps.ts +0 -11
- package/src/components/Button/buttonStyles.ts +0 -35
- package/src/components/Button/index.ts +0 -8
- package/src/components/CompoundButton/CompoundButton.stories.tsx +0 -46
- package/src/components/CompoundButton/CompoundButton.tsx +0 -53
- package/src/components/CompoundButton/index.ts +0 -5
- package/src/components/Dialog/Dialog.stories.tsx +0 -37
- package/src/components/Dialog/Dialog.tsx +0 -157
- package/src/components/Dialog/index.ts +0 -5
- package/src/components/Group/Group.stories.tsx +0 -25
- package/src/components/Group/Group.tsx +0 -32
- package/src/components/Group/index.ts +0 -5
- package/src/components/Heading/Heading.stories.tsx +0 -29
- package/src/components/Heading/Heading.tsx +0 -29
- package/src/components/Heading/index.ts +0 -5
- package/src/components/Input/BarePinInput.tsx +0 -67
- package/src/components/Input/BareTextInput.tsx +0 -48
- package/src/components/Input/BareTextareaInput.tsx +0 -39
- package/src/components/Input/Input.stories.tsx +0 -108
- package/src/components/Input/Input.tsx +0 -115
- package/src/components/Input/InputProps.ts +0 -47
- package/src/components/Input/index.ts +0 -5
- package/src/components/Loading/Loading.stories.tsx +0 -34
- package/src/components/Loading/Loading.tsx +0 -69
- package/src/components/Loading/index.ts +0 -5
- package/src/components/NavMenu/NavMenu.stories.tsx +0 -54
- package/src/components/NavMenu/NavMenu.tsx +0 -203
- package/src/components/NavMenu/index.ts +0 -5
- package/src/components/Popover/Popover.stories.tsx +0 -49
- package/src/components/Popover/Popover.tsx +0 -110
- package/src/components/Popover/index.ts +0 -5
- package/src/components/QrCode/QrCode.stories.tsx +0 -42
- package/src/components/QrCode/QrCode.tsx +0 -165
- package/src/components/QrCode/index.ts +0 -5
- package/src/components/Tag/Tag.stories.tsx +0 -23
- package/src/components/Tag/Tag.tsx +0 -32
- package/src/components/Tag/index.ts +0 -5
- package/src/components/Toast/Toast.stories.tsx +0 -31
- package/src/components/Toast/Toast.tsx +0 -106
- package/src/components/Toast/index.ts +0 -5
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -28
- package/src/components/Tooltip/Tooltip.tsx +0 -88
- package/src/components/Tooltip/index.ts +0 -5
- package/src/components/UiProvider/UiProvider.tsx +0 -44
- package/src/components/UiProvider/index.ts +0 -5
- package/src/components/index.ts +0 -21
- package/src/config/index.ts +0 -5
- package/src/config/tailwind.ts +0 -250
- package/src/esbuild-plugin.ts +0 -42
- package/src/hooks/index.ts +0 -7
- package/src/hooks/useForwardedRef.ts +0 -22
- package/src/hooks/useId.ts +0 -21
- package/src/hooks/useIsFocused.ts +0 -38
- package/src/plugin.ts +0 -44
- package/src/props/Elevation.ts +0 -5
- package/src/props/MessageValence.ts +0 -5
- package/src/props/Size.ts +0 -40
- package/src/props/index.ts +0 -7
- package/src/styles/active.ts +0 -11
- package/src/styles/disabled.ts +0 -5
- package/src/styles/focus.ts +0 -9
- package/src/styles/group.ts +0 -35
- package/src/styles/hover.ts +0 -10
- package/src/styles/input.ts +0 -46
- package/src/styles/ornament.ts +0 -6
- package/src/styles/shimmer.ts +0 -9
- package/src/styles/size.ts +0 -86
- package/src/styles/text.ts +0 -10
- package/src/styles/valence.ts +0 -71
- package/src/testing/templateForComponent.tsx +0 -16
- package/src/theme.css +0 -65
- package/src/typings.d.ts +0 -7
- package/src/util/index.ts +0 -5
- package/src/util/mx.ts +0 -28
- package/src/util/withLogical.ts +0 -103
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
|
6
|
-
import React, { ComponentProps, ForwardedRef, forwardRef, ReactNode } from 'react';
|
|
7
|
-
|
|
8
|
-
import { defaultFocus, defaultHover, defaultInlineSeparator } from '../../styles';
|
|
9
|
-
import { mx } from '../../util';
|
|
10
|
-
import { defaultButtonColors, primaryButtonColors } from '../Button';
|
|
11
|
-
import { Tooltip, TooltipProps } from '../Tooltip';
|
|
12
|
-
|
|
13
|
-
interface NavMenuItemSharedProps {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
active?: boolean;
|
|
16
|
-
separator?: false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface NavMenuLinkItemProps extends NavMenuItemSharedProps {
|
|
20
|
-
triggerLinkProps: Omit<ComponentProps<typeof NavigationMenuPrimitive.Link>, 'children'>;
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface NavMenuTooltipLinkItemProps extends NavMenuLinkItemProps {
|
|
25
|
-
tooltip: Omit<TooltipProps, 'children'>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface NavMenuInvokerItemProps extends NavMenuItemSharedProps {
|
|
29
|
-
content: ReactNode;
|
|
30
|
-
children: ReactNode;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface NavMenuSeparatorProps {
|
|
34
|
-
separator: true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type NavMenuItem =
|
|
38
|
-
| NavMenuTooltipLinkItemProps
|
|
39
|
-
| NavMenuLinkItemProps
|
|
40
|
-
| NavMenuInvokerItemProps
|
|
41
|
-
| NavMenuSeparatorProps;
|
|
42
|
-
|
|
43
|
-
export interface NavMenuSlots {
|
|
44
|
-
root?: Omit<ComponentProps<typeof NavigationMenuPrimitive.Root>, 'children'>;
|
|
45
|
-
viewport?: Omit<ComponentProps<typeof NavigationMenuPrimitive.Viewport>, 'children'>;
|
|
46
|
-
list?: Omit<ComponentProps<typeof NavigationMenuPrimitive.List>, 'children'>;
|
|
47
|
-
indicator?: Omit<ComponentProps<typeof NavigationMenuPrimitive.Indicator>, 'children'>;
|
|
48
|
-
indicatorIcon?: Pick<ComponentProps<'div'>, 'className'>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface NavMenuProps {
|
|
52
|
-
items: NavMenuItem[];
|
|
53
|
-
slots?: NavMenuSlots;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const NavMenuInvokerItem = forwardRef(
|
|
57
|
-
({ content, children, active }: NavMenuInvokerItemProps, ref: ForwardedRef<HTMLLIElement>) => {
|
|
58
|
-
return (
|
|
59
|
-
<NavigationMenuPrimitive.Item ref={ref}>
|
|
60
|
-
<NavigationMenuPrimitive.Trigger
|
|
61
|
-
className={mx(
|
|
62
|
-
'px-3 py-2 text-sm rounded-md text-sm font-medium transition-color',
|
|
63
|
-
active ? primaryButtonColors : defaultButtonColors,
|
|
64
|
-
defaultFocus,
|
|
65
|
-
defaultHover({})
|
|
66
|
-
)}
|
|
67
|
-
>
|
|
68
|
-
{children}
|
|
69
|
-
</NavigationMenuPrimitive.Trigger>
|
|
70
|
-
<NavigationMenuPrimitive.Content
|
|
71
|
-
className={mx(
|
|
72
|
-
'absolute w-auto top-0 left-0 rounded-lg',
|
|
73
|
-
'radix-motion-from-start:animate-enter-from-left',
|
|
74
|
-
'radix-motion-from-end:animate-enter-from-right',
|
|
75
|
-
'radix-motion-to-start:animate-exit-to-left',
|
|
76
|
-
'radix-motion-to-end:animate-exit-to-right'
|
|
77
|
-
)}
|
|
78
|
-
>
|
|
79
|
-
{content}
|
|
80
|
-
</NavigationMenuPrimitive.Content>
|
|
81
|
-
</NavigationMenuPrimitive.Item>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const NavMenuLinkItem = forwardRef(
|
|
87
|
-
({ triggerLinkProps, children, active }: NavMenuLinkItemProps, ref: ForwardedRef<HTMLLIElement>) => (
|
|
88
|
-
<NavigationMenuPrimitive.Item asChild ref={ref}>
|
|
89
|
-
<NavigationMenuPrimitive.Link
|
|
90
|
-
{...triggerLinkProps}
|
|
91
|
-
active={active}
|
|
92
|
-
className={mx(
|
|
93
|
-
'px-3 py-2 text-sm rounded-md transition-color',
|
|
94
|
-
active ? primaryButtonColors : defaultButtonColors,
|
|
95
|
-
active ? 'font-medium' : 'font-normal',
|
|
96
|
-
defaultFocus,
|
|
97
|
-
defaultHover({}),
|
|
98
|
-
triggerLinkProps.className
|
|
99
|
-
)}
|
|
100
|
-
>
|
|
101
|
-
{children}
|
|
102
|
-
</NavigationMenuPrimitive.Link>
|
|
103
|
-
</NavigationMenuPrimitive.Item>
|
|
104
|
-
)
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const NavMenuTooltipLinkItem = forwardRef(
|
|
108
|
-
({ tooltip, triggerLinkProps, active, children }: NavMenuTooltipLinkItemProps, ref: ForwardedRef<HTMLLIElement>) => (
|
|
109
|
-
<Tooltip {...tooltip}>
|
|
110
|
-
{/* todo: why does the Tooltip not show if you use <NavMenuLinkItem {…}/> here? */}
|
|
111
|
-
<NavigationMenuPrimitive.Item asChild ref={ref}>
|
|
112
|
-
<NavigationMenuPrimitive.Link
|
|
113
|
-
{...triggerLinkProps}
|
|
114
|
-
active={active}
|
|
115
|
-
className={mx(
|
|
116
|
-
'px-3 py-2 text-sm rounded-md transition-color',
|
|
117
|
-
active ? primaryButtonColors : defaultButtonColors,
|
|
118
|
-
active ? 'font-medium' : 'font-normal',
|
|
119
|
-
defaultFocus,
|
|
120
|
-
defaultHover({}),
|
|
121
|
-
triggerLinkProps.className
|
|
122
|
-
)}
|
|
123
|
-
>
|
|
124
|
-
{children}
|
|
125
|
-
</NavigationMenuPrimitive.Link>
|
|
126
|
-
</NavigationMenuPrimitive.Item>
|
|
127
|
-
</Tooltip>
|
|
128
|
-
)
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
export const NavMenuLink = NavigationMenuPrimitive.Link;
|
|
132
|
-
|
|
133
|
-
export const NavMenuSeparatorItem = (_props: NavMenuSeparatorProps) => {
|
|
134
|
-
return <span role='none' className={mx(defaultInlineSeparator, 'bs-5')} />;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const isTooltipLinkItem = (o: any): o is NavMenuTooltipLinkItemProps => 'tooltip' in o;
|
|
138
|
-
const isLinkItem = (o: any): o is NavMenuLinkItemProps => 'triggerLinkProps' in o;
|
|
139
|
-
const isSeparator = (o: any): o is NavMenuSeparatorProps => 'separator' in o;
|
|
140
|
-
|
|
141
|
-
export const NavMenu = ({ items, slots = {} }: NavMenuProps) => {
|
|
142
|
-
return (
|
|
143
|
-
<NavigationMenuPrimitive.Root {...slots.root} className={mx('flex justify-center', slots.root?.className)}>
|
|
144
|
-
<NavigationMenuPrimitive.List
|
|
145
|
-
{...slots.list}
|
|
146
|
-
className={mx(
|
|
147
|
-
'relative flex flex-row items-center gap-1 rounded-lg bg-white dark:bg-neutral-750 p-1 button-elevation overflow-x-auto',
|
|
148
|
-
slots.list?.className
|
|
149
|
-
)}
|
|
150
|
-
>
|
|
151
|
-
{items.map((item: NavMenuItem, i) => {
|
|
152
|
-
return isTooltipLinkItem(item) ? (
|
|
153
|
-
<NavMenuTooltipLinkItem key={i} {...item} />
|
|
154
|
-
) : isLinkItem(item) ? (
|
|
155
|
-
<NavMenuLinkItem key={i} {...item} />
|
|
156
|
-
) : isSeparator(item) ? (
|
|
157
|
-
<NavMenuSeparatorItem key={i} {...item} />
|
|
158
|
-
) : (
|
|
159
|
-
<NavMenuInvokerItem key={i} {...item} />
|
|
160
|
-
);
|
|
161
|
-
})}
|
|
162
|
-
|
|
163
|
-
<NavigationMenuPrimitive.Indicator
|
|
164
|
-
{...slots.indicator}
|
|
165
|
-
className={mx(
|
|
166
|
-
'z-10 top-[100%] flex items-end justify-center h-2 overflow-hidden',
|
|
167
|
-
'radix-state-visible:animate-fade-in',
|
|
168
|
-
'radix-state-hidden:animate-fade-out',
|
|
169
|
-
'transition-[width_transform] duration-[250ms] ease-[ease]',
|
|
170
|
-
slots.indicator?.className
|
|
171
|
-
)}
|
|
172
|
-
>
|
|
173
|
-
<div
|
|
174
|
-
className={mx(
|
|
175
|
-
'top-1 relative bg-white dark:bg-neutral-750 w-2 h-2 rotate-45',
|
|
176
|
-
slots.indicatorIcon?.className
|
|
177
|
-
)}
|
|
178
|
-
/>
|
|
179
|
-
</NavigationMenuPrimitive.Indicator>
|
|
180
|
-
</NavigationMenuPrimitive.List>
|
|
181
|
-
|
|
182
|
-
<div
|
|
183
|
-
className={mx('absolute flex justify-center', 'w-[140%] left-[-20%] top-[100%]')}
|
|
184
|
-
style={{
|
|
185
|
-
perspective: '2000px'
|
|
186
|
-
}}
|
|
187
|
-
>
|
|
188
|
-
<NavigationMenuPrimitive.Viewport
|
|
189
|
-
{...slots.viewport}
|
|
190
|
-
className={mx(
|
|
191
|
-
'relative mbs-2 shadow-lg rounded-md bg-white dark:bg-neutral-750 overflow-hidden',
|
|
192
|
-
'w-radix-navigation-menu-viewport',
|
|
193
|
-
'h-radix-navigation-menu-viewport',
|
|
194
|
-
'radix-state-open:animate-scale-in-content',
|
|
195
|
-
'radix-state-closed:animate-scale-out-content',
|
|
196
|
-
'origin-[top_center] transition-[width_height] duration-300 ease-[ease]',
|
|
197
|
-
slots.viewport?.className
|
|
198
|
-
)}
|
|
199
|
-
/>
|
|
200
|
-
</div>
|
|
201
|
-
</NavigationMenuPrimitive.Root>
|
|
202
|
-
);
|
|
203
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { defaultFocus, defaultHover, defaultActive } from '../../styles';
|
|
9
|
-
import { templateForComponent } from '../../testing';
|
|
10
|
-
import { mx } from '../../util';
|
|
11
|
-
import { Avatar } from '../Avatar';
|
|
12
|
-
import { Button } from '../Button';
|
|
13
|
-
import { Popover, PopoverProps } from './Popover';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
title: 'react-ui/Popover',
|
|
17
|
-
component: Popover
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const Template = ({ children, ...props }: PopoverProps) => {
|
|
21
|
-
return <Popover {...props}>{children}</Popover>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Default = templateForComponent(Template)({
|
|
25
|
-
openTrigger: '',
|
|
26
|
-
closeLabel: '',
|
|
27
|
-
children: ''
|
|
28
|
-
});
|
|
29
|
-
Default.args = {
|
|
30
|
-
openTrigger: <Button>Open popover</Button>,
|
|
31
|
-
children: 'Popover content'
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const AvatarTrigger = templateForComponent(Template)({
|
|
35
|
-
openTrigger: (
|
|
36
|
-
<Avatar
|
|
37
|
-
slots={{
|
|
38
|
-
root: {
|
|
39
|
-
tabIndex: 0,
|
|
40
|
-
className: mx('button-elevation cursor-pointer rounded-md', defaultHover({}), defaultFocus, defaultActive)
|
|
41
|
-
}
|
|
42
|
-
}}
|
|
43
|
-
label={<span className='sr-only'>Open popover</span>}
|
|
44
|
-
fallbackValue='open popover'
|
|
45
|
-
/>
|
|
46
|
-
),
|
|
47
|
-
closeLabel: 'Close',
|
|
48
|
-
children: 'Popover content'
|
|
49
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
6
|
-
import { Button as ToolbarButtonItem } from '@radix-ui/react-toolbar';
|
|
7
|
-
import { X } from 'phosphor-react';
|
|
8
|
-
import React, { ComponentProps, ReactNode, useCallback, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { defaultActive, defaultFocus, defaultHover, getSize } from '../../styles';
|
|
11
|
-
import { mx } from '../../util';
|
|
12
|
-
|
|
13
|
-
export interface PopoverSlots {
|
|
14
|
-
content?: Omit<ComponentProps<typeof PopoverPrimitive.Content>, 'children'>;
|
|
15
|
-
arrow?: Pick<ComponentProps<typeof PopoverPrimitive.Arrow>, 'className'>;
|
|
16
|
-
close?: Omit<ComponentProps<typeof PopoverPrimitive.Close>, 'children'>;
|
|
17
|
-
closeIcon?: ComponentProps<typeof X>;
|
|
18
|
-
trigger?: Omit<ComponentProps<typeof PopoverPrimitive.Trigger>, 'children'>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface PopoverProps {
|
|
22
|
-
openTrigger: ReactNode;
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
closeLabel?: string;
|
|
25
|
-
initiallyOpen?: boolean;
|
|
26
|
-
mountAsSibling?: boolean;
|
|
27
|
-
triggerIsInToolbar?: boolean;
|
|
28
|
-
slots?: PopoverSlots;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type KeyUpEvent = Parameters<Exclude<ComponentProps<typeof PopoverPrimitive.Trigger>['onKeyUp'], undefined>>[0];
|
|
32
|
-
|
|
33
|
-
export const Popover = ({
|
|
34
|
-
openTrigger,
|
|
35
|
-
children,
|
|
36
|
-
closeLabel,
|
|
37
|
-
initiallyOpen,
|
|
38
|
-
mountAsSibling,
|
|
39
|
-
triggerIsInToolbar,
|
|
40
|
-
slots = {}
|
|
41
|
-
}: PopoverProps) => {
|
|
42
|
-
const [isOpen, setIsOpen] = useState(!!initiallyOpen);
|
|
43
|
-
const onKeyUp = useCallback(
|
|
44
|
-
(e: KeyUpEvent) => {
|
|
45
|
-
const keyUpId = (document.activeElement as HTMLElement).dataset.keyupid;
|
|
46
|
-
if (keyUpId && e.key === ' ') {
|
|
47
|
-
setIsOpen(keyUpId === 'open');
|
|
48
|
-
}
|
|
49
|
-
slots.trigger?.onKeyUp?.(e);
|
|
50
|
-
},
|
|
51
|
-
[slots.trigger?.onKeyUp]
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const popoverContent = (
|
|
55
|
-
<PopoverPrimitive.Content
|
|
56
|
-
align='center'
|
|
57
|
-
{...slots.content}
|
|
58
|
-
className={mx(
|
|
59
|
-
'radix-side-top:animate-slide-up radix-side-bottom:animate-slide-down',
|
|
60
|
-
'rounded-lg p-4 shadow-xl elevated-buttons',
|
|
61
|
-
'bg-white dark:bg-neutral-800',
|
|
62
|
-
defaultFocus,
|
|
63
|
-
slots.content?.className
|
|
64
|
-
)}
|
|
65
|
-
>
|
|
66
|
-
<PopoverPrimitive.Arrow className={mx('fill-current text-white dark:text-neutral-800', slots.arrow?.className)} />
|
|
67
|
-
{children}
|
|
68
|
-
{closeLabel && (
|
|
69
|
-
<PopoverPrimitive.Close
|
|
70
|
-
{...slots.close}
|
|
71
|
-
className={mx(
|
|
72
|
-
'absolute top-3.5 right-3.5 inline-flex items-center justify-center rounded-sm p-1',
|
|
73
|
-
defaultFocus,
|
|
74
|
-
defaultHover({}),
|
|
75
|
-
slots.close?.className
|
|
76
|
-
)}
|
|
77
|
-
aria-label={closeLabel}
|
|
78
|
-
data-keyupid='close'
|
|
79
|
-
>
|
|
80
|
-
<X
|
|
81
|
-
{...slots.closeIcon}
|
|
82
|
-
className={mx(
|
|
83
|
-
getSize(4),
|
|
84
|
-
'text-neutral-500 hover:text-neutral-700 dark:text-neutral-500 dark:hover:text-neutral-400',
|
|
85
|
-
slots.closeIcon?.className
|
|
86
|
-
)}
|
|
87
|
-
/>
|
|
88
|
-
</PopoverPrimitive.Close>
|
|
89
|
-
)}
|
|
90
|
-
</PopoverPrimitive.Content>
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const trigger = (
|
|
94
|
-
<PopoverPrimitive.Trigger
|
|
95
|
-
{...slots.trigger}
|
|
96
|
-
onKeyUp={onKeyUp}
|
|
97
|
-
data-keyupid='open'
|
|
98
|
-
className={mx(defaultHover({}), defaultFocus, defaultActive, slots.trigger?.className)}
|
|
99
|
-
>
|
|
100
|
-
{openTrigger}
|
|
101
|
-
</PopoverPrimitive.Trigger>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<PopoverPrimitive.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
106
|
-
{triggerIsInToolbar ? <ToolbarButtonItem asChild>{trigger}</ToolbarButtonItem> : trigger}
|
|
107
|
-
{mountAsSibling ? popoverContent : <PopoverPrimitive.Portal>{popoverContent}</PopoverPrimitive.Portal>}
|
|
108
|
-
</PopoverPrimitive.Root>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { templateForComponent } from '../../testing';
|
|
9
|
-
import { QrCode, QrCodeProps, CompactQrCode, CompactQrCodeProps } from './QrCode';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'react-ui/QrCode',
|
|
13
|
-
component: QrCode
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Template = (props: QrCodeProps) => {
|
|
17
|
-
return <QrCode {...props} />;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const CompactTemplate = (props: CompactQrCodeProps) => {
|
|
21
|
-
return <CompactQrCode {...props} />;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Default = templateForComponent(Template)({
|
|
25
|
-
value: '',
|
|
26
|
-
label: ''
|
|
27
|
-
});
|
|
28
|
-
Default.args = {
|
|
29
|
-
label: 'Click to copy this code’s value',
|
|
30
|
-
value: 'https://dxos.org'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Compact = templateForComponent(CompactTemplate)({
|
|
34
|
-
value: '',
|
|
35
|
-
copyLabel: '',
|
|
36
|
-
displayQrLabel: ''
|
|
37
|
-
});
|
|
38
|
-
Compact.args = {
|
|
39
|
-
copyLabel: 'Copy',
|
|
40
|
-
displayQrLabel: 'Display QR',
|
|
41
|
-
value: 'https://dxos.org'
|
|
42
|
-
};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { QrCode as QrCodeIcon, CopySimple } from 'phosphor-react';
|
|
6
|
-
import { QRCodeSVG } from 'qrcode.react';
|
|
7
|
-
import React, { useCallback, ReactHTMLElement, ComponentProps } from 'react';
|
|
8
|
-
|
|
9
|
-
import { useId } from '../../hooks';
|
|
10
|
-
import { Size } from '../../props';
|
|
11
|
-
import { getSize } from '../../styles';
|
|
12
|
-
import { mx } from '../../util';
|
|
13
|
-
import { Button, ButtonGroup } from '../Button';
|
|
14
|
-
import { Tooltip, TooltipSlots } from '../Tooltip';
|
|
15
|
-
|
|
16
|
-
interface SharedQrCodeProps {
|
|
17
|
-
value: string;
|
|
18
|
-
buttonCompact?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface FullQrCodeSlots {
|
|
22
|
-
tooltipContent?: TooltipSlots['content'];
|
|
23
|
-
tooltipArrow?: TooltipSlots['arrow'];
|
|
24
|
-
button?: Omit<ComponentProps<'button'>, 'ref' | 'children'>;
|
|
25
|
-
qrSvg?: ComponentProps<typeof QRCodeSVG>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface FullQrCodeProps extends SharedQrCodeProps {
|
|
29
|
-
label: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;
|
|
30
|
-
size?: Size;
|
|
31
|
-
slots?: FullQrCodeSlots;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type QrCodeProps = FullQrCodeProps;
|
|
35
|
-
|
|
36
|
-
interface CompactQrCodeSlots {
|
|
37
|
-
qrTooltipContent?: TooltipSlots['content'];
|
|
38
|
-
qrTooltipArrow?: TooltipSlots['arrow'];
|
|
39
|
-
qrButton?: Omit<ComponentProps<'button'>, 'ref' | 'children'>;
|
|
40
|
-
copyTooltipContent?: TooltipSlots['content'];
|
|
41
|
-
copyTooltipArrow?: TooltipSlots['arrow'];
|
|
42
|
-
copyButton?: Omit<ComponentProps<'button'>, 'ref' | 'children'>;
|
|
43
|
-
qrSvg?: ComponentProps<typeof QRCodeSVG>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface CompactQrCodeProps extends SharedQrCodeProps {
|
|
47
|
-
displayQrLabel: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;
|
|
48
|
-
copyLabel: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;
|
|
49
|
-
slots?: CompactQrCodeSlots;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const FullQrCode = ({ value, label, size, buttonCompact = true, slots = {} }: FullQrCodeProps) => {
|
|
53
|
-
const labelId = useId('qr-label');
|
|
54
|
-
const copyValue = useCallback(() => {
|
|
55
|
-
void navigator.clipboard.writeText(value);
|
|
56
|
-
}, [value]);
|
|
57
|
-
return (
|
|
58
|
-
<Tooltip content={label} {...slots.tooltipContent}>
|
|
59
|
-
<Button
|
|
60
|
-
compact={buttonCompact}
|
|
61
|
-
{...slots.button}
|
|
62
|
-
className={mx('overflow-hidden p-0', getSize(size ?? 32), slots.button?.className)}
|
|
63
|
-
onClick={copyValue}
|
|
64
|
-
>
|
|
65
|
-
<QRCodeSVG
|
|
66
|
-
includeMargin
|
|
67
|
-
role='none'
|
|
68
|
-
{...slots.qrSvg}
|
|
69
|
-
value={value}
|
|
70
|
-
className={mx('w-full h-auto', slots.qrSvg?.className)}
|
|
71
|
-
/>
|
|
72
|
-
<div id={labelId} className='sr-only'>
|
|
73
|
-
{label}
|
|
74
|
-
</div>
|
|
75
|
-
</Button>
|
|
76
|
-
</Tooltip>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const CompactQrCode = ({ value, displayQrLabel, copyLabel, buttonCompact, slots = {} }: CompactQrCodeProps) => {
|
|
81
|
-
const labelId = useId('qr-label');
|
|
82
|
-
const copyValue = useCallback(() => {
|
|
83
|
-
void navigator.clipboard.writeText(value);
|
|
84
|
-
}, [value]);
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<ButtonGroup className='inline-flex grow md:hidden'>
|
|
88
|
-
<span className='sr-only' id={labelId}>
|
|
89
|
-
{displayQrLabel}
|
|
90
|
-
</span>
|
|
91
|
-
<Tooltip
|
|
92
|
-
compact
|
|
93
|
-
slots={{ content: { ...slots.qrTooltipContent, side: slots?.qrTooltipContent?.side ?? 'left' } }}
|
|
94
|
-
content={
|
|
95
|
-
<div role='none' className='overflow-hidden rounded-md'>
|
|
96
|
-
<QRCodeSVG
|
|
97
|
-
includeMargin
|
|
98
|
-
role='none'
|
|
99
|
-
{...slots.qrSvg}
|
|
100
|
-
value={value}
|
|
101
|
-
className={mx(getSize(32), slots.qrSvg?.className)}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
}
|
|
105
|
-
>
|
|
106
|
-
<Button
|
|
107
|
-
compact={buttonCompact}
|
|
108
|
-
{...slots.qrButton}
|
|
109
|
-
className={mx('border-ie-0 grow rounded-is-md', slots.qrButton?.className)}
|
|
110
|
-
aria-labelledby={labelId}
|
|
111
|
-
>
|
|
112
|
-
<QrCodeIcon className={getSize(5)} />
|
|
113
|
-
</Button>
|
|
114
|
-
</Tooltip>
|
|
115
|
-
<Tooltip content={copyLabel} tooltipLabelsTrigger slots={{ content: slots.qrTooltipContent }}>
|
|
116
|
-
<Button
|
|
117
|
-
compact={buttonCompact}
|
|
118
|
-
{...slots.copyButton}
|
|
119
|
-
className={mx('rounded-ie-md grow', slots.copyButton?.className)}
|
|
120
|
-
onClick={copyValue}
|
|
121
|
-
>
|
|
122
|
-
<CopySimple className={getSize(5)} />
|
|
123
|
-
</Button>
|
|
124
|
-
</Tooltip>
|
|
125
|
-
</ButtonGroup>
|
|
126
|
-
<ButtonGroup className='hidden md:inline-flex'>
|
|
127
|
-
<Tooltip
|
|
128
|
-
compact
|
|
129
|
-
slots={{ content: { ...slots.qrTooltipContent, side: slots?.qrTooltipContent?.side ?? 'left' } }}
|
|
130
|
-
content={
|
|
131
|
-
<div role='none' className='overflow-hidden rounded-md'>
|
|
132
|
-
<QRCodeSVG
|
|
133
|
-
includeMargin
|
|
134
|
-
role='none'
|
|
135
|
-
{...slots.qrSvg}
|
|
136
|
-
value={value}
|
|
137
|
-
className={mx(getSize(32), slots.qrSvg?.className)}
|
|
138
|
-
/>
|
|
139
|
-
</div>
|
|
140
|
-
}
|
|
141
|
-
>
|
|
142
|
-
<Button
|
|
143
|
-
compact={buttonCompact}
|
|
144
|
-
{...slots.qrButton}
|
|
145
|
-
className={mx('border-ie-0 flex gap-1 rounded-is-md', slots.qrButton?.className)}
|
|
146
|
-
>
|
|
147
|
-
<QrCodeIcon className={getSize(5)} />
|
|
148
|
-
{displayQrLabel}
|
|
149
|
-
</Button>
|
|
150
|
-
</Tooltip>
|
|
151
|
-
<Button
|
|
152
|
-
compact={buttonCompact}
|
|
153
|
-
{...slots.copyButton}
|
|
154
|
-
className={mx('flex gap-1 rounded-ie-md', slots.copyButton?.className)}
|
|
155
|
-
onClick={copyValue}
|
|
156
|
-
>
|
|
157
|
-
<CopySimple className={getSize(5)} />
|
|
158
|
-
{copyLabel}
|
|
159
|
-
</Button>
|
|
160
|
-
</ButtonGroup>
|
|
161
|
-
</>
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const QrCode = FullQrCode;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { templateForComponent } from '../../testing';
|
|
9
|
-
import { Tag, TagProps } from './Tag';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'react-ui/Tag',
|
|
13
|
-
component: Tag
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Template = ({ children, ...props }: TagProps) => {
|
|
17
|
-
return <Tag {...props}>{children}</Tag>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultProps = {};
|
|
21
|
-
|
|
22
|
-
export const Default = templateForComponent(Template)(defaultProps);
|
|
23
|
-
Default.args = { children: 'Hello' };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { ComponentProps, PropsWithChildren, ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { MessageValence } from '../../props';
|
|
8
|
-
import { mx } from '../../util';
|
|
9
|
-
|
|
10
|
-
export interface TagProps extends ComponentProps<'span'> {
|
|
11
|
-
valence?: MessageValence;
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const valenceColorMap: Record<MessageValence, string> = {
|
|
16
|
-
neutral: 'bg-neutral-100 text-neutral-800 dark:bg-neutral-700 dark:text-neutral-300',
|
|
17
|
-
success: 'bg-success-100 text-success-800 dark:bg-success-700 dark:text-success-300',
|
|
18
|
-
info: 'bg-info-100 text-info-800 dark:bg-info-700 dark:text-info-300',
|
|
19
|
-
warning: 'bg-warning-100 text-warning-800 dark:bg-warning-700 dark:text-warning-300',
|
|
20
|
-
error: 'bg-error-100 text-error-800 dark:bg-error-700 dark:text-error-300'
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const Tag = ({ children, valence = 'neutral', ...rootSlot }: PropsWithChildren<TagProps>) => {
|
|
24
|
-
return (
|
|
25
|
-
<span
|
|
26
|
-
{...rootSlot}
|
|
27
|
-
className={mx('text-xs font-semibold px-2.5 py-0.5 rounded', valenceColorMap[valence], rootSlot?.className)}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</span>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { templateForComponent } from '../../testing';
|
|
9
|
-
import { Button } from '../Button';
|
|
10
|
-
import { Toast, ToastProps } from './Toast';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'react-ui/Toast',
|
|
14
|
-
component: Toast
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Template = ({ ...props }: ToastProps) => {
|
|
18
|
-
return <Toast {...props} />;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Default = templateForComponent(Template)({
|
|
22
|
-
title: ''
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
Default.args = {
|
|
26
|
-
openTrigger: 'Open toast',
|
|
27
|
-
title: 'Hi, this is a toast',
|
|
28
|
-
description: 'This goes away on its own with a timer.',
|
|
29
|
-
actionTriggers: [{ altText: 'Press F5 to reload the page', trigger: <Button>Reload</Button> }],
|
|
30
|
-
closeTrigger: <Button>Close</Button>
|
|
31
|
-
};
|