@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,106 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
6
|
-
import React, { cloneElement, ComponentProps, ReactHTMLElement, ReactNode, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { defaultDescription, defaultFocus } from '../../styles';
|
|
9
|
-
import { mx } from '../../util';
|
|
10
|
-
import { Button } from '../Button';
|
|
11
|
-
|
|
12
|
-
export interface ToastSlots {
|
|
13
|
-
root?: Omit<ComponentProps<typeof ToastPrimitive.Root>, 'children'>;
|
|
14
|
-
heading?: Omit<ComponentProps<'div'>, 'children'>;
|
|
15
|
-
headingInner?: Omit<ComponentProps<'div'>, 'children'>;
|
|
16
|
-
title?: Omit<ComponentProps<typeof ToastPrimitive.Title>, 'children'>;
|
|
17
|
-
description?: Omit<ComponentProps<typeof ToastPrimitive.Description>, 'children'>;
|
|
18
|
-
actions?: Omit<ComponentProps<'div'>, 'children'>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ToastProps extends Omit<ComponentProps<typeof ToastPrimitive.Root>, 'title'> {
|
|
22
|
-
title: ReactNode;
|
|
23
|
-
openTrigger?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;
|
|
24
|
-
closeTrigger?: ReactNode;
|
|
25
|
-
actionTriggers?: { altText: string; trigger: ReactNode }[];
|
|
26
|
-
titleVisuallyHidden?: boolean;
|
|
27
|
-
description?: ReactNode;
|
|
28
|
-
initiallyOpen?: boolean;
|
|
29
|
-
slots?: ToastSlots;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const Toast = ({
|
|
33
|
-
title,
|
|
34
|
-
titleVisuallyHidden,
|
|
35
|
-
description,
|
|
36
|
-
openTrigger,
|
|
37
|
-
closeTrigger,
|
|
38
|
-
actionTriggers,
|
|
39
|
-
initiallyOpen,
|
|
40
|
-
slots = {}
|
|
41
|
-
}: ToastProps) => {
|
|
42
|
-
const [isOpen, setIsOpen] = useState(!!initiallyOpen);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
{openTrigger &&
|
|
47
|
-
(typeof openTrigger === 'string' ? (
|
|
48
|
-
<Button onClick={() => setIsOpen(true)}>{openTrigger}</Button>
|
|
49
|
-
) : (
|
|
50
|
-
cloneElement(openTrigger as Omit<ReactHTMLElement<HTMLElement>, 'ref'>, { onClick: () => setIsOpen(true) })
|
|
51
|
-
))}
|
|
52
|
-
<ToastPrimitive.Root
|
|
53
|
-
open={isOpen}
|
|
54
|
-
onOpenChange={setIsOpen}
|
|
55
|
-
{...slots.root}
|
|
56
|
-
className={mx(
|
|
57
|
-
'shadow-lg rounded-lg elevated-buttons flex',
|
|
58
|
-
'bg-white dark:bg-neutral-800',
|
|
59
|
-
'radix-state-open:animate-toast-slide-in-bottom md:radix-state-open:animate-toast-slide-in-right',
|
|
60
|
-
'radix-state-closed:animate-toast-hide',
|
|
61
|
-
'radix-swipe-end:animate-toast-swipe-out',
|
|
62
|
-
'translate-x-radix-toast-swipe-move-x',
|
|
63
|
-
'radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]',
|
|
64
|
-
defaultFocus,
|
|
65
|
-
slots.root?.className
|
|
66
|
-
)}
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
role='none'
|
|
70
|
-
{...slots.heading}
|
|
71
|
-
className={mx('w-0 flex-1 flex items-center pl-5 py-4 min-h-full', slots.heading?.className)}
|
|
72
|
-
>
|
|
73
|
-
<div
|
|
74
|
-
role='none'
|
|
75
|
-
{...slots.headingInner}
|
|
76
|
-
className={mx('w-full radix flex flex-col justify-center min-h-full gap-1', slots.headingInner?.className)}
|
|
77
|
-
>
|
|
78
|
-
<ToastPrimitive.Title className={mx('text-md font-medium', titleVisuallyHidden && 'sr-only')}>
|
|
79
|
-
{title}
|
|
80
|
-
</ToastPrimitive.Title>
|
|
81
|
-
{description && (
|
|
82
|
-
<ToastPrimitive.Description className={defaultDescription}>{description}</ToastPrimitive.Description>
|
|
83
|
-
)}
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div
|
|
87
|
-
role='none'
|
|
88
|
-
{...slots.actions}
|
|
89
|
-
className={mx(
|
|
90
|
-
'flex flex-col px-3 py-2 gap-1 items-stretch justify-center min-h-full',
|
|
91
|
-
slots.actions?.className
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
{(actionTriggers || []).map(({ altText, trigger }, index) => (
|
|
95
|
-
<ToastPrimitive.Action key={index} altText={altText} asChild={typeof trigger !== 'string'}>
|
|
96
|
-
{trigger}
|
|
97
|
-
</ToastPrimitive.Action>
|
|
98
|
-
))}
|
|
99
|
-
{closeTrigger && (
|
|
100
|
-
<ToastPrimitive.Close asChild={typeof closeTrigger !== 'string'}>{closeTrigger}</ToastPrimitive.Close>
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
103
|
-
</ToastPrimitive.Root>
|
|
104
|
-
</>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import { ChatTeardropText } from 'phosphor-react';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { templateForComponent } from '../../testing';
|
|
10
|
-
import { Tooltip, TooltipProps } from './Tooltip';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'react-ui/Tooltip',
|
|
14
|
-
component: Tooltip
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Template = ({ children, content }: TooltipProps) => {
|
|
18
|
-
return <Tooltip content={content}>{children}</Tooltip>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Default = templateForComponent(Template)({
|
|
22
|
-
children: '',
|
|
23
|
-
content: ''
|
|
24
|
-
});
|
|
25
|
-
Default.args = {
|
|
26
|
-
children: <ChatTeardropText className='w-8 h-8' />,
|
|
27
|
-
content: 'Here’s a tooltip for you!'
|
|
28
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as PortalPrimitive from '@radix-ui/react-portal';
|
|
6
|
-
import { Button as ToolbarButtonItem } from '@radix-ui/react-toolbar';
|
|
7
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
|
-
import React, { ComponentProps, ReactNode, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { useId } from '../../hooks';
|
|
11
|
-
import { defaultTooltip } from '../../styles';
|
|
12
|
-
import { mx } from '../../util';
|
|
13
|
-
|
|
14
|
-
export interface TooltipSlots {
|
|
15
|
-
content?: Omit<ComponentProps<typeof TooltipPrimitive.Content>, 'children'>;
|
|
16
|
-
arrow?: Pick<ComponentProps<typeof TooltipPrimitive.Arrow>, 'className'>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface TooltipProps {
|
|
20
|
-
content: ReactNode;
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
side?: TooltipPrimitive.TooltipContentProps['side'];
|
|
23
|
-
compact?: boolean;
|
|
24
|
-
tooltipLabelsTrigger?: boolean;
|
|
25
|
-
mountAsSibling?: boolean;
|
|
26
|
-
triggerIsInToolbar?: boolean;
|
|
27
|
-
zIndex?: string;
|
|
28
|
-
slots?: TooltipSlots;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const Tooltip = ({
|
|
32
|
-
content,
|
|
33
|
-
children,
|
|
34
|
-
side,
|
|
35
|
-
compact,
|
|
36
|
-
tooltipLabelsTrigger,
|
|
37
|
-
mountAsSibling,
|
|
38
|
-
triggerIsInToolbar,
|
|
39
|
-
zIndex = 'z-[2]',
|
|
40
|
-
slots = {}
|
|
41
|
-
}: TooltipProps) => {
|
|
42
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
43
|
-
const labelId = useId('tooltipLabel');
|
|
44
|
-
|
|
45
|
-
const tooltipContent = (
|
|
46
|
-
<TooltipPrimitive.Content
|
|
47
|
-
forceMount
|
|
48
|
-
{...slots.content}
|
|
49
|
-
side={side ?? slots.content?.side ?? 'top'}
|
|
50
|
-
className={mx(
|
|
51
|
-
'radix-side-top:animate-slide-down-fade',
|
|
52
|
-
'radix-side-right:animate-slide-left-fade',
|
|
53
|
-
'radix-side-bottom:animate-slide-up-fade',
|
|
54
|
-
'radix-side-left:animate-slide-right-fade',
|
|
55
|
-
'inline-flex items-center rounded-md',
|
|
56
|
-
zIndex,
|
|
57
|
-
!compact && 'px-4 py-2.5',
|
|
58
|
-
'shadow-lg bg-white dark:bg-neutral-800',
|
|
59
|
-
!isOpen && 'sr-only',
|
|
60
|
-
defaultTooltip,
|
|
61
|
-
slots.content?.className
|
|
62
|
-
)}
|
|
63
|
-
>
|
|
64
|
-
<TooltipPrimitive.Arrow className={mx('fill-current text-white dark:text-neutral-800', slots.arrow?.className)} />
|
|
65
|
-
{content}
|
|
66
|
-
</TooltipPrimitive.Content>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const triggerContent = (
|
|
70
|
-
<TooltipPrimitive.Trigger asChild {...(tooltipLabelsTrigger && { 'aria-labelledby': labelId })}>
|
|
71
|
-
{children}
|
|
72
|
-
</TooltipPrimitive.Trigger>
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<TooltipPrimitive.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
77
|
-
{triggerIsInToolbar ? <ToolbarButtonItem asChild>{triggerContent}</ToolbarButtonItem> : triggerContent}
|
|
78
|
-
{tooltipLabelsTrigger && (
|
|
79
|
-
<PortalPrimitive.Root asChild>
|
|
80
|
-
<span id={labelId} className='sr-only'>
|
|
81
|
-
{content}
|
|
82
|
-
</span>
|
|
83
|
-
</PortalPrimitive.Root>
|
|
84
|
-
)}
|
|
85
|
-
{mountAsSibling ? tooltipContent : <TooltipPrimitive.Portal forceMount>{tooltipContent}</TooltipPrimitive.Portal>}
|
|
86
|
-
</TooltipPrimitive.Root>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Provider as ToastProvider,
|
|
7
|
-
ToastProviderProps,
|
|
8
|
-
Viewport as ToastViewport,
|
|
9
|
-
ToastViewportProps
|
|
10
|
-
} from '@radix-ui/react-toast';
|
|
11
|
-
import { Provider as TooltipProvider, TooltipProviderProps } from '@radix-ui/react-tooltip';
|
|
12
|
-
import React, { PropsWithChildren } from 'react';
|
|
13
|
-
|
|
14
|
-
import { defaultFocus } from '../../styles';
|
|
15
|
-
import { mx } from '../../util';
|
|
16
|
-
|
|
17
|
-
export type UiProviderProps = PropsWithChildren<{
|
|
18
|
-
tooltipProviderProps?: TooltipProviderProps;
|
|
19
|
-
toastProviderProps?: ToastProviderProps;
|
|
20
|
-
toastViewportProps?: ToastViewportProps;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
export const UiProvider = ({
|
|
24
|
-
children,
|
|
25
|
-
tooltipProviderProps,
|
|
26
|
-
toastProviderProps,
|
|
27
|
-
toastViewportProps
|
|
28
|
-
}: UiProviderProps) => {
|
|
29
|
-
return (
|
|
30
|
-
<ToastProvider {...toastProviderProps}>
|
|
31
|
-
<TooltipProvider delayDuration={0} {...tooltipProviderProps}>
|
|
32
|
-
{children}
|
|
33
|
-
</TooltipProvider>
|
|
34
|
-
<ToastViewport
|
|
35
|
-
{...toastViewportProps}
|
|
36
|
-
className={mx(
|
|
37
|
-
'z-50 fixed bottom-4 inset-x-4 w-auto md:top-4 md:right-4 md:left-auto md:bottom-auto md:w-full md:max-w-sm rounded-lg flex flex-col gap-2',
|
|
38
|
-
defaultFocus,
|
|
39
|
-
toastViewportProps?.className
|
|
40
|
-
)}
|
|
41
|
-
/>
|
|
42
|
-
</ToastProvider>
|
|
43
|
-
);
|
|
44
|
-
};
|
package/src/components/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
export * from './Alert';
|
|
6
|
-
export * from './AlertDialog';
|
|
7
|
-
export * from './Avatar';
|
|
8
|
-
export * from './Button';
|
|
9
|
-
export * from './CompoundButton';
|
|
10
|
-
export * from './Dialog';
|
|
11
|
-
export * from './Group';
|
|
12
|
-
export * from './Heading';
|
|
13
|
-
export * from './Loading';
|
|
14
|
-
export * from './Input';
|
|
15
|
-
export * from './NavMenu';
|
|
16
|
-
export * from './Popover';
|
|
17
|
-
export * from './QrCode';
|
|
18
|
-
export * from './Tag';
|
|
19
|
-
export * from './Toast';
|
|
20
|
-
export * from './Tooltip';
|
|
21
|
-
export * from './UiProvider';
|
package/src/config/index.ts
DELETED
package/src/config/tailwind.ts
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import tailwindcssForms from '@tailwindcss/forms';
|
|
6
|
-
import { resolve } from 'node:path';
|
|
7
|
-
import type { Config } from 'tailwindcss';
|
|
8
|
-
import tailwindcssLogical from 'tailwindcss-logical';
|
|
9
|
-
import tailwindcssRadix from 'tailwindcss-radix';
|
|
10
|
-
import tailwindColors from 'tailwindcss/colors';
|
|
11
|
-
import defaultConfig from 'tailwindcss/stubs/defaultConfig.stub.js';
|
|
12
|
-
|
|
13
|
-
export const tailwindConfig = ({
|
|
14
|
-
env = 'production',
|
|
15
|
-
root = './',
|
|
16
|
-
content = []
|
|
17
|
-
}: {
|
|
18
|
-
env?: string;
|
|
19
|
-
root?: string;
|
|
20
|
-
content?: string[];
|
|
21
|
-
}): Config => ({
|
|
22
|
-
darkMode: 'class',
|
|
23
|
-
theme: {
|
|
24
|
-
fontFamily: {
|
|
25
|
-
body: ['Roboto FlexVariable', ...defaultConfig.theme.fontFamily.sans],
|
|
26
|
-
display: ['Space GroteskVariable', 'Roboto FlexVariable', ...defaultConfig.theme.fontFamily.sans],
|
|
27
|
-
mono: ['Fira CodeVariable', ...defaultConfig.theme.fontFamily.mono]
|
|
28
|
-
},
|
|
29
|
-
extend: {
|
|
30
|
-
colors: {
|
|
31
|
-
success: tailwindColors.emerald,
|
|
32
|
-
warning: tailwindColors.amber,
|
|
33
|
-
error: tailwindColors.rose,
|
|
34
|
-
info: tailwindColors.cyan,
|
|
35
|
-
neutral: {
|
|
36
|
-
// Key color #707076
|
|
37
|
-
// Hue torsion 0.0º
|
|
38
|
-
// C*CP black 0.80, C*CP white 0.88
|
|
39
|
-
950: '#101012',
|
|
40
|
-
900: '#1b1b1e',
|
|
41
|
-
850: '#252529',
|
|
42
|
-
800: '#303034',
|
|
43
|
-
750: '#3b3b3f',
|
|
44
|
-
700: '#46464b',
|
|
45
|
-
650: '#525257',
|
|
46
|
-
600: '#5e5e64',
|
|
47
|
-
550: '#6a6a70',
|
|
48
|
-
500: '#77767d',
|
|
49
|
-
450: '#838389',
|
|
50
|
-
400: '#909096',
|
|
51
|
-
350: '#9d9da4',
|
|
52
|
-
300: '#ababb1',
|
|
53
|
-
250: '#b8b8be',
|
|
54
|
-
200: '#c6c6cc',
|
|
55
|
-
150: '#d4d4d9',
|
|
56
|
-
100: '#e2e2e7',
|
|
57
|
-
50: '#f1f1f4'
|
|
58
|
-
},
|
|
59
|
-
primary: {
|
|
60
|
-
// Key color #00e0e0
|
|
61
|
-
// Hue torsion -73.5º
|
|
62
|
-
// C*CP black 1.0, C*CP white 1.0
|
|
63
|
-
950: '#110c2a',
|
|
64
|
-
900: '#101940',
|
|
65
|
-
850: '#0b2453',
|
|
66
|
-
800: '#003164',
|
|
67
|
-
750: '#003e70',
|
|
68
|
-
700: '#004b7c',
|
|
69
|
-
650: '#005887',
|
|
70
|
-
600: '#006693',
|
|
71
|
-
550: '#00749e',
|
|
72
|
-
500: '#0082a9',
|
|
73
|
-
450: '#0091b3',
|
|
74
|
-
400: '#00a0be',
|
|
75
|
-
350: '#00afc7',
|
|
76
|
-
300: '#00bed0',
|
|
77
|
-
250: '#00ced8',
|
|
78
|
-
200: '#00dedf',
|
|
79
|
-
150: '#3cede4',
|
|
80
|
-
100: '#69fae8',
|
|
81
|
-
50: '#b9ffee'
|
|
82
|
-
},
|
|
83
|
-
transparent: 'transparent',
|
|
84
|
-
current: 'currentColor',
|
|
85
|
-
white: '#ffffff',
|
|
86
|
-
black: '#000000'
|
|
87
|
-
},
|
|
88
|
-
fontSize: {
|
|
89
|
-
// Base size 16px
|
|
90
|
-
// Scale 1.125
|
|
91
|
-
xs: ['0.790rem', { lineHeight: '1rem' }],
|
|
92
|
-
sm: ['0.889rem', { lineHeight: '1.25rem' }],
|
|
93
|
-
base: ['1rem', { lineHeight: '1.5rem' }],
|
|
94
|
-
lg: ['1.125rem', { lineHeight: '1.75rem' }],
|
|
95
|
-
xl: ['1.266rem', { lineHeight: '1.75rem' }],
|
|
96
|
-
'2xl': ['1.424rem', { lineHeight: '2rem' }],
|
|
97
|
-
'3xl': ['1.602rem', { lineHeight: '2.25rem' }],
|
|
98
|
-
'4xl': ['1.802rem', { lineHeight: '2.5rem' }],
|
|
99
|
-
'5xl': ['2.027rem', { lineHeight: '2.5rem' }],
|
|
100
|
-
'6xl': ['2.281rem', { lineHeight: '2.5rem' }],
|
|
101
|
-
'7xl': ['2.566rem', { lineHeight: '2.75rem' }],
|
|
102
|
-
'8xl': ['2.887rem', { lineHeight: '3rem' }],
|
|
103
|
-
'9xl': ['3.247rem', { lineHeight: '3.25rem' }]
|
|
104
|
-
},
|
|
105
|
-
outlineWidth: {
|
|
106
|
-
3: '3px'
|
|
107
|
-
},
|
|
108
|
-
boxShadow: {
|
|
109
|
-
slider: '0 0 0 5px rgba(0, 0, 0, 0.3)'
|
|
110
|
-
},
|
|
111
|
-
keyframes: {
|
|
112
|
-
// Dropdown menu
|
|
113
|
-
'scale-in': {
|
|
114
|
-
'0%': { opacity: '0', transform: 'scale(0)' },
|
|
115
|
-
'100%': { opacity: '1', transform: 'scale(1)' }
|
|
116
|
-
},
|
|
117
|
-
'slide-down': {
|
|
118
|
-
'0%': { opacity: '0', transform: 'translateY(-10px)' },
|
|
119
|
-
'100%': { opacity: '1', transform: 'translateY(0)' }
|
|
120
|
-
},
|
|
121
|
-
'slide-up': {
|
|
122
|
-
'0%': { opacity: '0', transform: 'translateY(10px)' },
|
|
123
|
-
'100%': { opacity: '1', transform: 'translateY(0)' }
|
|
124
|
-
},
|
|
125
|
-
// Tooltip
|
|
126
|
-
'slide-up-fade': {
|
|
127
|
-
'0%': { opacity: '0', transform: 'translateY(2px)' },
|
|
128
|
-
'100%': { opacity: '1', transform: 'translateY(0)' }
|
|
129
|
-
},
|
|
130
|
-
'slide-right-fade': {
|
|
131
|
-
'0%': { opacity: '0', transform: 'translateX(-2px)' },
|
|
132
|
-
'100%': { opacity: '1', transform: 'translateX(0)' }
|
|
133
|
-
},
|
|
134
|
-
'slide-down-fade': {
|
|
135
|
-
'0%': { opacity: '0', transform: 'translateY(-2px)' },
|
|
136
|
-
'100%': { opacity: '1', transform: 'translateY(0)' }
|
|
137
|
-
},
|
|
138
|
-
'slide-left-fade': {
|
|
139
|
-
'0%': { opacity: '0', transform: 'translateX(2px)' },
|
|
140
|
-
'100%': { opacity: '1', transform: 'translateX(0)' }
|
|
141
|
-
},
|
|
142
|
-
// Navigation menu
|
|
143
|
-
'enter-from-right': {
|
|
144
|
-
'0%': { transform: 'translateX(200px)', opacity: '0' },
|
|
145
|
-
'100%': { transform: 'translateX(0)', opacity: '1' }
|
|
146
|
-
},
|
|
147
|
-
'enter-from-left': {
|
|
148
|
-
'0%': { transform: 'translateX(-200px)', opacity: '0' },
|
|
149
|
-
'100%': { transform: 'translateX(0)', opacity: '1' }
|
|
150
|
-
},
|
|
151
|
-
'exit-to-right': {
|
|
152
|
-
'0%': { transform: 'translateX(0)', opacity: '1' },
|
|
153
|
-
'100%': { transform: 'translateX(200px)', opacity: '0' }
|
|
154
|
-
},
|
|
155
|
-
'exit-to-left': {
|
|
156
|
-
'0%': { transform: 'translateX(0)', opacity: '1' },
|
|
157
|
-
'100%': {
|
|
158
|
-
transform: 'translateX(-200px)',
|
|
159
|
-
opacity: '0'
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
'scale-in-content': {
|
|
163
|
-
'0%': {
|
|
164
|
-
transform: 'rotateX(-30deg) scale(0.9)',
|
|
165
|
-
opacity: '0'
|
|
166
|
-
},
|
|
167
|
-
'100%': {
|
|
168
|
-
transform: 'rotateX(0deg) scale(1)',
|
|
169
|
-
opacity: '1'
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
'scale-out-content': {
|
|
173
|
-
'0%': {
|
|
174
|
-
transform: 'rotateX(0deg) scale(1)',
|
|
175
|
-
opacity: '1'
|
|
176
|
-
},
|
|
177
|
-
'100%': {
|
|
178
|
-
transform: 'rotateX(-10deg) scale(0.95)',
|
|
179
|
-
opacity: '0'
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
'fade-in': {
|
|
183
|
-
'0%': { opacity: '0' },
|
|
184
|
-
'100%': { opacity: '1' }
|
|
185
|
-
},
|
|
186
|
-
'fade-out': {
|
|
187
|
-
'0%': { opacity: '1' },
|
|
188
|
-
'100%': { opacity: '0' }
|
|
189
|
-
},
|
|
190
|
-
// Toast
|
|
191
|
-
'toast-hide': {
|
|
192
|
-
'0%': { opacity: '1' },
|
|
193
|
-
'100%': { opacity: '0' }
|
|
194
|
-
},
|
|
195
|
-
'toast-slide-in-right': {
|
|
196
|
-
'0%': { transform: 'translateX(calc(100% + 1rem))' },
|
|
197
|
-
'100%': { transform: 'translateX(0)' }
|
|
198
|
-
},
|
|
199
|
-
'toast-slide-in-bottom': {
|
|
200
|
-
'0%': { transform: 'translateY(calc(100% + 1rem))' },
|
|
201
|
-
'100%': { transform: 'translateY(0)' }
|
|
202
|
-
},
|
|
203
|
-
'toast-swipe-out': {
|
|
204
|
-
'0%': {
|
|
205
|
-
transform: 'translateX(var(--radix-toast-swipe-end-x))'
|
|
206
|
-
},
|
|
207
|
-
'100%': {
|
|
208
|
-
transform: 'translateX(calc(100% + 1rem))'
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
// Shimmer
|
|
212
|
-
'shimmer-loop': {
|
|
213
|
-
'100%': {
|
|
214
|
-
transform: 'translateX(100%)'
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
animation: {
|
|
219
|
-
// Dropdown menu
|
|
220
|
-
'scale-in': 'scale-in 0.2s ease-in-out',
|
|
221
|
-
'slide-down': 'slide-down 0.6s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
222
|
-
'slide-up': 'slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
223
|
-
// Tooltip
|
|
224
|
-
'slide-up-fade': 'slide-up-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
225
|
-
'slide-right-fade': 'slide-right-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
226
|
-
'slide-down-fade': 'slide-down-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
227
|
-
'slide-left-fade': 'slide-left-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)',
|
|
228
|
-
// Navigation menu
|
|
229
|
-
'enter-from-right': 'enter-from-right 0.25s ease',
|
|
230
|
-
'enter-from-left': 'enter-from-left 0.25s ease',
|
|
231
|
-
'exit-to-right': 'exit-to-right 0.25s ease',
|
|
232
|
-
'exit-to-left': 'exit-to-left 0.25s ease',
|
|
233
|
-
'scale-in-content': 'scale-in-content 0.2s ease',
|
|
234
|
-
'scale-out-content': 'scale-out-content 0.2s ease',
|
|
235
|
-
'fade-in': 'fade-in 0.2s ease',
|
|
236
|
-
'fade-out': 'fade-out 0.2s ease',
|
|
237
|
-
// Toast
|
|
238
|
-
'toast-hide': 'toast-hide 100ms ease-in forwards',
|
|
239
|
-
'toast-slide-in-right': 'toast-slide-in-right 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
240
|
-
'toast-slide-in-bottom': 'toast-slide-in-bottom 150ms cubic-bezier(0.16, 1, 0.3, 1)',
|
|
241
|
-
'toast-swipe-out': 'toast-swipe-out 100ms ease-out forwards',
|
|
242
|
-
// Shimmer
|
|
243
|
-
shimmer: 'shimmer-loop 2s infinite'
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
plugins: [tailwindcssLogical, tailwindcssForms, tailwindcssRadix()],
|
|
248
|
-
...(env === 'development' && { mode: 'jit' }),
|
|
249
|
-
content: [resolve(root, 'node_modules/@dxos/react-ui/dist/**/*.mjs'), ...content]
|
|
250
|
-
});
|
package/src/esbuild-plugin.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import autoprefixer from 'autoprefixer';
|
|
6
|
-
import type { Plugin } from 'esbuild';
|
|
7
|
-
import stylePlugin from 'esbuild-style-plugin';
|
|
8
|
-
import { mkdir, cp } from 'node:fs/promises';
|
|
9
|
-
import { resolve, relative, join, basename } from 'node:path';
|
|
10
|
-
import tailwindcss from 'tailwindcss';
|
|
11
|
-
|
|
12
|
-
import { tailwindConfig } from './config';
|
|
13
|
-
|
|
14
|
-
export const ThemePlugins = (options: { content: string[]; outdir: string }): Plugin[] => {
|
|
15
|
-
return [
|
|
16
|
-
// TODO (thure): This really shouldn’t be this way, but after hours of searching for a reasonable way to do this I came up empty. The prior art I found was mainly this thread, though it’s only tangentially related: https://github.com/evanw/esbuild/issues/800#issuecomment-786151076
|
|
17
|
-
{
|
|
18
|
-
name: 'esbuild-plugin-dxos-ui-theme-resolvers',
|
|
19
|
-
setup: async (build) => {
|
|
20
|
-
const fontsDir = join(options.outdir, 'node_modules/@dxos/react-ui/fonts');
|
|
21
|
-
try {
|
|
22
|
-
await mkdir(fontsDir);
|
|
23
|
-
} catch (_e) {}
|
|
24
|
-
build.onResolve({ filter: /\.woff2$/ }, async (args) => {
|
|
25
|
-
const depPath = resolve(args.resolveDir, args.path);
|
|
26
|
-
const destPath = join(fontsDir, basename(args.path));
|
|
27
|
-
try {
|
|
28
|
-
await cp(depPath, destPath);
|
|
29
|
-
} catch (_e) {}
|
|
30
|
-
return { path: `./${relative(options.outdir, join('fonts', basename(args.path)))}`, external: true };
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
// TODO (thure): theme.css must be part of entryPoints in order to be processed with `stylePlugin`, but this should not be necessary. ESBuild would not load theme.css using stylePlugin if referenced within index.ts(x) as with the Vite plugin.
|
|
35
|
-
// TODO (thure): Note also that because it is an entryPoint, the developer has to reference the built theme.css from `index.html`, which is inflexible and possibly inconvenient.
|
|
36
|
-
stylePlugin({
|
|
37
|
-
postcss: {
|
|
38
|
-
plugins: [tailwindcss(tailwindConfig({ env: process.env.NODE_ENV, content: options.content })), autoprefixer]
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
];
|
|
42
|
-
};
|
package/src/hooks/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useRef, useEffect } from 'react';
|
|
6
|
-
|
|
7
|
-
export const useForwardedRef = <T>(ref: React.ForwardedRef<T>) => {
|
|
8
|
-
const innerRef = useRef<T>(null);
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!ref) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (typeof ref === 'function') {
|
|
15
|
-
ref(innerRef.current);
|
|
16
|
-
} else {
|
|
17
|
-
ref.current = innerRef.current;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
return innerRef;
|
|
22
|
-
};
|
package/src/hooks/useId.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import alea from 'alea';
|
|
6
|
-
import { useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
interface PrngFactory {
|
|
9
|
-
new (seed?: string): () => number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const Alea: PrngFactory = alea as unknown as PrngFactory;
|
|
13
|
-
|
|
14
|
-
const prng = new Alea('@dxos/react-ui');
|
|
15
|
-
|
|
16
|
-
export const randomString = (n = 4) =>
|
|
17
|
-
prng()
|
|
18
|
-
.toString(16)
|
|
19
|
-
.slice(2, n + 2);
|
|
20
|
-
|
|
21
|
-
export const useId = (namespace: string, n?: number) => useMemo(() => `${namespace}-${randomString(n)}`, []);
|