@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,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import React, { PropsWithChildren } from 'react';
|
|
7
|
-
|
|
8
|
-
import { templateForComponent } from '../../testing';
|
|
9
|
-
import { Group } from '../Group';
|
|
10
|
-
import { Button } from './Button';
|
|
11
|
-
import { ButtonProps } from './ButtonProps';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'react-ui/Button',
|
|
15
|
-
component: Button
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const Container = ({ children }: PropsWithChildren<{}>) => (
|
|
19
|
-
<>
|
|
20
|
-
<Group label={{ children: null }} elevation={0} className='flex gap-4 px-1 mb-4'>
|
|
21
|
-
{children}
|
|
22
|
-
</Group>
|
|
23
|
-
<Group label={{ children: null }} elevation={5} className='flex gap-4 px-1'>
|
|
24
|
-
{children}
|
|
25
|
-
</Group>
|
|
26
|
-
</>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const Template = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => (
|
|
30
|
-
<Container>
|
|
31
|
-
<Button {...args}>{children}</Button>
|
|
32
|
-
<Button {...args} disabled>
|
|
33
|
-
Disabled
|
|
34
|
-
</Button>
|
|
35
|
-
</Container>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export const Default = templateForComponent(Template)({});
|
|
39
|
-
Default.args = { children: 'Hello', disabled: false, variant: 'default' };
|
|
40
|
-
|
|
41
|
-
export const Primary = () => <Template {...{ variant: 'primary', children: 'Hello' }} />;
|
|
42
|
-
|
|
43
|
-
export const Outline = () => <Template {...{ variant: 'outline', children: 'Hello' }} />;
|
|
44
|
-
|
|
45
|
-
export const Ghost = () => <Template {...{ variant: 'ghost', children: 'Hello' }} />;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
import { ButtonProps } from './ButtonProps';
|
|
9
|
-
import { buttonStyles } from './buttonStyles';
|
|
10
|
-
|
|
11
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(({ children, compact, variant, ...rootSlot }, ref) => (
|
|
12
|
-
<button
|
|
13
|
-
ref={ref}
|
|
14
|
-
{...rootSlot}
|
|
15
|
-
className={mx(buttonStyles({ compact, variant, disabled: rootSlot.disabled }), rootSlot.className)}
|
|
16
|
-
{...(rootSlot.disabled && { disabled: true })}
|
|
17
|
-
>
|
|
18
|
-
{children}
|
|
19
|
-
</button>
|
|
20
|
-
));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { ComponentProps, ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export interface ButtonGroupProps extends ComponentProps<'div'> {
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const ButtonGroup = ({ children, ...divProps }: ButtonGroupProps) => {
|
|
14
|
-
return (
|
|
15
|
-
<div
|
|
16
|
-
role='none'
|
|
17
|
-
{...divProps}
|
|
18
|
-
className={mx('button-elevation [&>*]:grouped-buttons rounded-md', divProps.className)}
|
|
19
|
-
>
|
|
20
|
-
{children}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defaultDisabled, defaultFocus, defaultHover, defaultActive } from '../../styles';
|
|
6
|
-
import { mx } from '../../util';
|
|
7
|
-
import { ButtonProps } from './ButtonProps';
|
|
8
|
-
|
|
9
|
-
export const primaryButtonColors = 'bg-primary-600 text-white hover:bg-primary-650';
|
|
10
|
-
export const defaultButtonColors = 'bg-white text-neutral-900 dark:bg-neutral-750 dark:text-neutral-50';
|
|
11
|
-
export const ghostButtonColors = '';
|
|
12
|
-
|
|
13
|
-
export const buttonStyles = (props: ButtonProps) => {
|
|
14
|
-
const resolvedVariant = props.variant || 'default';
|
|
15
|
-
return mx(
|
|
16
|
-
'inline-flex select-none items-center justify-center text-sm font-medium rounded-md transition-color duration-100',
|
|
17
|
-
props.compact ? 'p-1.5' : 'pli-4 plb-2',
|
|
18
|
-
defaultHover(props),
|
|
19
|
-
resolvedVariant === 'default' && 'border border-neutral-100 dark:border-neutral-650',
|
|
20
|
-
resolvedVariant !== 'ghost' && !props.disabled && 'hover:focus:border-neutral-100 hover:border-transparent',
|
|
21
|
-
resolvedVariant === 'default' && defaultButtonColors,
|
|
22
|
-
resolvedVariant === 'ghost' && ghostButtonColors,
|
|
23
|
-
resolvedVariant === 'primary' && 'border border-primary-550 hover:border-transparent',
|
|
24
|
-
resolvedVariant === 'primary' && primaryButtonColors,
|
|
25
|
-
resolvedVariant === 'outline' &&
|
|
26
|
-
'text-neutral-700 border border-neutral-600 dark:border-neutral-300 dark:text-neutral-150',
|
|
27
|
-
defaultFocus,
|
|
28
|
-
props.disabled
|
|
29
|
-
? defaultDisabled
|
|
30
|
-
: resolvedVariant !== 'outline' && resolvedVariant !== 'ghost' && 'button-elevation',
|
|
31
|
-
// Register all radix states
|
|
32
|
-
'group',
|
|
33
|
-
defaultActive
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxosTheme';
|
|
6
|
-
import { ArrowRight, ClockCounterClockwise } from 'phosphor-react';
|
|
7
|
-
import React, { PropsWithChildren } from 'react';
|
|
8
|
-
|
|
9
|
-
import { templateForComponent } from '../../testing';
|
|
10
|
-
import { CompoundButton, CompoundButtonProps } from './CompoundButton';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'react-ui/CompoundButton',
|
|
14
|
-
component: CompoundButton
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Container = ({ children }: PropsWithChildren<{}>) => <div className='flex gap-4'>{children}</div>;
|
|
18
|
-
|
|
19
|
-
const Template = ({ ...args }: Omit<CompoundButtonProps, 'ref'>) => (
|
|
20
|
-
<Container>
|
|
21
|
-
<CompoundButton {...args} />
|
|
22
|
-
<CompoundButton {...args} disabled />
|
|
23
|
-
</Container>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export const Default = templateForComponent(Template)({});
|
|
27
|
-
Default.args = {
|
|
28
|
-
children: 'Hello',
|
|
29
|
-
description: 'This is a compound button',
|
|
30
|
-
before: <ClockCounterClockwise className='w-5 h-5' />,
|
|
31
|
-
after: <ArrowRight className='w-5 h-5' />,
|
|
32
|
-
disabled: false
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const Primary = () => (
|
|
36
|
-
<Template
|
|
37
|
-
{...{
|
|
38
|
-
children: 'Hello',
|
|
39
|
-
description: 'This is a compound button',
|
|
40
|
-
before: <ClockCounterClockwise className='w-5 h-5' />,
|
|
41
|
-
after: <ArrowRight className='w-5 h-5' />,
|
|
42
|
-
disabled: false,
|
|
43
|
-
variant: 'primary'
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useId } from '../../hooks';
|
|
8
|
-
import { defaultDescription, primaryDescription } from '../../styles';
|
|
9
|
-
import { mx } from '../../util';
|
|
10
|
-
import { ButtonProps, buttonStyles } from '../Button';
|
|
11
|
-
|
|
12
|
-
export interface CompoundButtonProps extends ButtonProps {
|
|
13
|
-
children?: ReactNode;
|
|
14
|
-
description?: ReactNode;
|
|
15
|
-
before?: ReactNode;
|
|
16
|
-
after?: ReactNode;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const CompoundButton = ({ children, description, before, after, ...buttonProps }: CompoundButtonProps) => {
|
|
20
|
-
const variant = buttonProps.variant || 'default';
|
|
21
|
-
const labelId = useId('compoundButton-label');
|
|
22
|
-
const descriptionId = useId('compoundButton-description');
|
|
23
|
-
return (
|
|
24
|
-
<button
|
|
25
|
-
{...buttonProps}
|
|
26
|
-
className={mx(buttonStyles(buttonProps), 'flex items-center gap-4 py-2.5', buttonProps.className)}
|
|
27
|
-
aria-labelledby={labelId}
|
|
28
|
-
{...(description && { 'aria-describedby': descriptionId })}
|
|
29
|
-
>
|
|
30
|
-
{before && (
|
|
31
|
-
<div role='none' className='grow-0'>
|
|
32
|
-
{before}
|
|
33
|
-
</div>
|
|
34
|
-
)}
|
|
35
|
-
<div role='none' className='grow flex flex-col gap-1 text-left'>
|
|
36
|
-
<p id={labelId}>{children}</p>
|
|
37
|
-
{description && (
|
|
38
|
-
<p
|
|
39
|
-
id={descriptionId}
|
|
40
|
-
className={mx('text-xs font-normal mb-1', variant === 'primary' ? primaryDescription : defaultDescription)}
|
|
41
|
-
>
|
|
42
|
-
{description}
|
|
43
|
-
</p>
|
|
44
|
-
)}
|
|
45
|
-
</div>
|
|
46
|
-
{after && (
|
|
47
|
-
<div role='none' className='grow-0'>
|
|
48
|
-
{after}
|
|
49
|
-
</div>
|
|
50
|
-
)}
|
|
51
|
-
</button>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
@@ -1,37 +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 { Dialog, DialogProps } from './Dialog';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'react-ui/Dialog',
|
|
14
|
-
component: Dialog
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Template = ({ children, ...props }: DialogProps) => {
|
|
18
|
-
return <Dialog {...props}>{children}</Dialog>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Default = templateForComponent(Template)({
|
|
22
|
-
openTrigger: '',
|
|
23
|
-
title: '',
|
|
24
|
-
closeTriggers: ['']
|
|
25
|
-
});
|
|
26
|
-
Default.args = {
|
|
27
|
-
openTrigger: <Button>Open dialog</Button>,
|
|
28
|
-
closeTriggers: [
|
|
29
|
-
<Button key='cancel'>Close trigger 1</Button>,
|
|
30
|
-
<Button key='save' variant='primary'>
|
|
31
|
-
Close trigger 2
|
|
32
|
-
</Button>
|
|
33
|
-
],
|
|
34
|
-
title: 'Dialog title',
|
|
35
|
-
children: 'Dialog content',
|
|
36
|
-
closeLabel: 'Close'
|
|
37
|
-
};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Transition } from '@headlessui/react';
|
|
6
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
7
|
-
import { X } from 'phosphor-react';
|
|
8
|
-
import React, { ComponentProps, Fragment, ReactNode, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { defaultDescription, defaultFocus, defaultHover, getSize } from '../../styles';
|
|
11
|
-
import { mx } from '../../util';
|
|
12
|
-
import { Tooltip } from '../Tooltip';
|
|
13
|
-
|
|
14
|
-
export interface DialogSlots {
|
|
15
|
-
overlay?: Pick<ComponentProps<typeof DialogPrimitive.Overlay>, 'className'>;
|
|
16
|
-
content?: Omit<ComponentProps<typeof DialogPrimitive.Content>, 'children'>;
|
|
17
|
-
title?: Omit<ComponentProps<typeof DialogPrimitive.Content>, 'children'>;
|
|
18
|
-
description?: Omit<ComponentProps<typeof DialogPrimitive.Description>, 'children'>;
|
|
19
|
-
close?: Pick<ComponentProps<typeof DialogPrimitive.Close>, 'className'>;
|
|
20
|
-
closeIcon?: ComponentProps<typeof X>;
|
|
21
|
-
closeTriggers?: Omit<ComponentProps<'div'>, 'children'>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface DialogProps {
|
|
25
|
-
title: ReactNode;
|
|
26
|
-
openTrigger?: ReactNode;
|
|
27
|
-
closeTriggers?: [ReactNode, ...ReactNode[]];
|
|
28
|
-
titleVisuallyHidden?: boolean;
|
|
29
|
-
description?: ReactNode;
|
|
30
|
-
children?: ReactNode;
|
|
31
|
-
closeLabel?: string;
|
|
32
|
-
initiallyOpen?: boolean;
|
|
33
|
-
mountAsSibling?: boolean;
|
|
34
|
-
slots?: DialogSlots;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const Dialog = ({
|
|
38
|
-
title,
|
|
39
|
-
titleVisuallyHidden,
|
|
40
|
-
description,
|
|
41
|
-
openTrigger,
|
|
42
|
-
children,
|
|
43
|
-
closeTriggers,
|
|
44
|
-
closeLabel,
|
|
45
|
-
initiallyOpen,
|
|
46
|
-
mountAsSibling,
|
|
47
|
-
slots = {}
|
|
48
|
-
}: DialogProps) => {
|
|
49
|
-
const [isOpen, setIsOpen] = useState(!!initiallyOpen);
|
|
50
|
-
|
|
51
|
-
const dialogOverlayAndContent = (
|
|
52
|
-
<Transition.Root show={isOpen}>
|
|
53
|
-
<Transition.Child
|
|
54
|
-
as={Fragment}
|
|
55
|
-
enter='linear duration-300'
|
|
56
|
-
enterFrom='opacity-0'
|
|
57
|
-
enterTo='opacity-100'
|
|
58
|
-
leave='linear duration-200'
|
|
59
|
-
leaveFrom='opacity-100'
|
|
60
|
-
leaveTo='opacity-0'
|
|
61
|
-
>
|
|
62
|
-
<DialogPrimitive.Overlay
|
|
63
|
-
forceMount
|
|
64
|
-
{...slots.overlay}
|
|
65
|
-
className={mx('fixed inset-0 z-20 bg-black/50', slots.overlay?.className)}
|
|
66
|
-
/>
|
|
67
|
-
</Transition.Child>
|
|
68
|
-
<Transition.Child
|
|
69
|
-
as={Fragment}
|
|
70
|
-
enter='ease-out duration-300'
|
|
71
|
-
enterFrom='opacity-0 scale-95'
|
|
72
|
-
enterTo='opacity-100 scale-100'
|
|
73
|
-
leave='ease-in duration-200'
|
|
74
|
-
leaveFrom='opacity-100 scale-100'
|
|
75
|
-
leaveTo='opacity-0 scale-95'
|
|
76
|
-
>
|
|
77
|
-
<DialogPrimitive.Content
|
|
78
|
-
forceMount
|
|
79
|
-
{...slots.content}
|
|
80
|
-
className={mx(
|
|
81
|
-
'fixed z-50',
|
|
82
|
-
'w-[95vw] max-w-md rounded-xl p-4 md:w-full',
|
|
83
|
-
'top-[50%] left-[50%] -translate-x-[50%] -translate-y-[50%]',
|
|
84
|
-
'shadow-2xl bg-white dark:bg-neutral-800 elevated-buttons',
|
|
85
|
-
defaultFocus,
|
|
86
|
-
slots.content?.className
|
|
87
|
-
)}
|
|
88
|
-
>
|
|
89
|
-
<DialogPrimitive.Title
|
|
90
|
-
{...slots.title}
|
|
91
|
-
className={mx(
|
|
92
|
-
'text-2xl font-display font-medium text-neutral-900 dark:text-neutral-100 rounded-md',
|
|
93
|
-
titleVisuallyHidden && 'sr-only',
|
|
94
|
-
defaultFocus,
|
|
95
|
-
slots.content?.className
|
|
96
|
-
)}
|
|
97
|
-
tabIndex={0}
|
|
98
|
-
>
|
|
99
|
-
{title}
|
|
100
|
-
</DialogPrimitive.Title>
|
|
101
|
-
{description && (
|
|
102
|
-
<DialogPrimitive.Description
|
|
103
|
-
{...slots.description}
|
|
104
|
-
className={mx('mt-2', defaultDescription, slots.description?.className)}
|
|
105
|
-
>
|
|
106
|
-
{description}
|
|
107
|
-
</DialogPrimitive.Description>
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
{children}
|
|
111
|
-
|
|
112
|
-
{closeLabel && (
|
|
113
|
-
<Tooltip zIndex='z-[51]' content={closeLabel}>
|
|
114
|
-
<DialogPrimitive.Close
|
|
115
|
-
className={mx(
|
|
116
|
-
'absolute top-3.5 right-3.5 inline-flex items-center justify-center rounded-sm p-1',
|
|
117
|
-
defaultFocus,
|
|
118
|
-
defaultHover({}),
|
|
119
|
-
slots.close?.className
|
|
120
|
-
)}
|
|
121
|
-
>
|
|
122
|
-
<X
|
|
123
|
-
className={mx(
|
|
124
|
-
getSize(4),
|
|
125
|
-
'text-neutral-500 hover:text-neutral-700 dark:text-neutral-500 dark:hover:text-neutral-400',
|
|
126
|
-
slots.closeIcon?.className
|
|
127
|
-
)}
|
|
128
|
-
/>
|
|
129
|
-
</DialogPrimitive.Close>
|
|
130
|
-
</Tooltip>
|
|
131
|
-
)}
|
|
132
|
-
{closeTriggers && (
|
|
133
|
-
<div
|
|
134
|
-
{...slots.closeTriggers}
|
|
135
|
-
className={mx('flex flex-wrap justify-end gap-4', slots.closeTriggers?.className)}
|
|
136
|
-
>
|
|
137
|
-
{closeTriggers.map((closeTrigger, key) => (
|
|
138
|
-
<DialogPrimitive.Close key={key}>{closeTrigger}</DialogPrimitive.Close>
|
|
139
|
-
))}
|
|
140
|
-
</div>
|
|
141
|
-
)}
|
|
142
|
-
</DialogPrimitive.Content>
|
|
143
|
-
</Transition.Child>
|
|
144
|
-
</Transition.Root>
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<DialogPrimitive.Root open={isOpen} onOpenChange={setIsOpen}>
|
|
149
|
-
{openTrigger && <DialogPrimitive.Trigger asChild>{openTrigger}</DialogPrimitive.Trigger>}
|
|
150
|
-
{mountAsSibling ? (
|
|
151
|
-
dialogOverlayAndContent
|
|
152
|
-
) : (
|
|
153
|
-
<DialogPrimitive.Portal>{dialogOverlayAndContent}</DialogPrimitive.Portal>
|
|
154
|
-
)}
|
|
155
|
-
</DialogPrimitive.Root>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
@@ -1,25 +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 { Group, GroupProps } from './Group';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'react-ui/Group',
|
|
13
|
-
component: Group
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Template = ({ children, ...props }: GroupProps) => {
|
|
17
|
-
return <Group {...props}>{children}</Group>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const Default = templateForComponent(Template)({ label: {} });
|
|
21
|
-
Default.args = {
|
|
22
|
-
label: { level: 3, children: 'Hello' },
|
|
23
|
-
children: 'This is a group.',
|
|
24
|
-
elevation: 3
|
|
25
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useId } from '../../hooks';
|
|
8
|
-
import { defaultGroup } from '../../styles';
|
|
9
|
-
import { mx } from '../../util';
|
|
10
|
-
import { Heading, HeadingProps } from '../Heading';
|
|
11
|
-
|
|
12
|
-
export interface GroupProps extends React.ComponentProps<'div'> {
|
|
13
|
-
label: HeadingProps;
|
|
14
|
-
labelVisuallyHidden?: boolean;
|
|
15
|
-
elevation?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
16
|
-
children?: ReactNode;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Group = ({ elevation = 3, children, label, labelVisuallyHidden, ...rootSlot }: GroupProps) => {
|
|
20
|
-
const labelId = useId('groupLabel');
|
|
21
|
-
return (
|
|
22
|
-
<div
|
|
23
|
-
role='group'
|
|
24
|
-
aria-labelledby={labelId}
|
|
25
|
-
{...rootSlot}
|
|
26
|
-
className={mx(defaultGroup({ elevation }), rootSlot?.className)}
|
|
27
|
-
>
|
|
28
|
-
<Heading {...label} id={labelId} className={mx(labelVisuallyHidden && 'sr-only', 'mb-2', label?.className)} />
|
|
29
|
-
{children}
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
@@ -1,29 +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 { Heading, HeadingProps } from './Heading';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'react-ui/Heading',
|
|
13
|
-
component: Heading
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Template = ({ children, ...props }: HeadingProps) => {
|
|
17
|
-
return <Heading {...props}>{children}</Heading>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultProps = { level: 1 as const };
|
|
21
|
-
|
|
22
|
-
export const Default = templateForComponent(Template)(defaultProps);
|
|
23
|
-
Default.args = { level: 1, children: 'Hello' };
|
|
24
|
-
|
|
25
|
-
export const Level2 = () => <Template level={2}>Hello</Template>;
|
|
26
|
-
export const Level3 = () => <Template level={3}>Hello</Template>;
|
|
27
|
-
export const Level4 = () => <Template level={4}>Hello</Template>;
|
|
28
|
-
export const Level5 = () => <Template level={5}>Hello</Template>;
|
|
29
|
-
export const Level6 = () => <Template level={6}>Hello</Template>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { createElement, PropsWithChildren, ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { mx } from '../../util';
|
|
8
|
-
|
|
9
|
-
export interface HeadingProps extends React.ComponentProps<'h1'> {
|
|
10
|
-
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
-
children?: ReactNode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const levelClassNameMap = new Map<number, string>([
|
|
15
|
-
[1, 'text-5xl'],
|
|
16
|
-
[2, 'text-4xl'],
|
|
17
|
-
[3, 'text-3xl'],
|
|
18
|
-
[4, 'text-2xl'],
|
|
19
|
-
[5, 'text-xl'],
|
|
20
|
-
[6, 'text-lg']
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export const Heading = ({ level, ...rootSlot }: PropsWithChildren<HeadingProps>) => {
|
|
24
|
-
const resolvedLevel = level || 1;
|
|
25
|
-
return createElement(`h${resolvedLevel}`, {
|
|
26
|
-
...rootSlot,
|
|
27
|
-
className: mx('font-bold font-display', levelClassNameMap.get(resolvedLevel), rootSlot.className)
|
|
28
|
-
});
|
|
29
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { CodeInput, getSegmentCssWidth } from 'rci';
|
|
6
|
-
import React, { forwardRef, useCallback, ComponentProps } from 'react';
|
|
7
|
-
|
|
8
|
-
import { useForwardedRef, useIsFocused } from '../../hooks';
|
|
9
|
-
import { staticInput } from '../../styles/input';
|
|
10
|
-
import { mx } from '../../util';
|
|
11
|
-
import { InputProps, InputSlots } from './InputProps';
|
|
12
|
-
|
|
13
|
-
const bareInputStyleProps = {
|
|
14
|
-
padding: '8px',
|
|
15
|
-
spacing: '8px',
|
|
16
|
-
fontFamily: ''
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type BarePinInputProps = Omit<InputProps, 'ref' | 'label' | 'onChange' | 'slots'> &
|
|
20
|
-
Pick<ComponentProps<typeof CodeInput>, 'onChange' | 'value' | 'length'> & { inputSlot: InputSlots['input'] };
|
|
21
|
-
|
|
22
|
-
// TODO(thure): supplying a `value` prop to CodeInput does not yield correct controlled input interactivity; this may be an issue with RCI (filed as https://github.com/leonardodino/rci/issues/25).
|
|
23
|
-
export const BarePinInput = forwardRef<HTMLInputElement, BarePinInputProps>(
|
|
24
|
-
(
|
|
25
|
-
{ initialValue, size, validationMessage, validationValence, value, onChange, placeholder, disabled, inputSlot },
|
|
26
|
-
ref
|
|
27
|
-
) => {
|
|
28
|
-
const width = getSegmentCssWidth('13px');
|
|
29
|
-
const inputRef = useForwardedRef(ref);
|
|
30
|
-
const inputFocused = useIsFocused(inputRef);
|
|
31
|
-
|
|
32
|
-
const renderSegment = useCallback<ComponentProps<typeof CodeInput>['renderSegment']>(
|
|
33
|
-
({ state, index }) => (
|
|
34
|
-
<div
|
|
35
|
-
key={index}
|
|
36
|
-
className={staticInput({
|
|
37
|
-
focused: inputFocused && !!state,
|
|
38
|
-
disabled,
|
|
39
|
-
...(validationMessage && { validationValence })
|
|
40
|
-
})}
|
|
41
|
-
data-state={state}
|
|
42
|
-
style={{ width, height: '100%' }}
|
|
43
|
-
/>
|
|
44
|
-
),
|
|
45
|
-
[inputFocused, validationValence, validationMessage, disabled]
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<CodeInput
|
|
50
|
-
{...{
|
|
51
|
-
spellCheck: false,
|
|
52
|
-
...bareInputStyleProps,
|
|
53
|
-
...inputSlot,
|
|
54
|
-
placeholder,
|
|
55
|
-
onChange,
|
|
56
|
-
inputRef,
|
|
57
|
-
renderSegment,
|
|
58
|
-
className: mx(
|
|
59
|
-
'font-mono selection:bg-transparent mli-auto',
|
|
60
|
-
disabled && 'cursor-not-allowed',
|
|
61
|
-
inputSlot?.className
|
|
62
|
-
)
|
|
63
|
-
}}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
);
|