@dxos/react-ui 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77
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/dist/lib/browser/{chunk-T6YPS45E.mjs → chunk-LBCJC75U.mjs} +186 -103
- package/dist/lib/browser/chunk-LBCJC75U.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +21 -22
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-TYVQJ4KW.mjs → chunk-QTUGGUCB.mjs} +186 -103
- package/dist/lib/node-esm/chunk-QTUGGUCB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -1
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +21 -22
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +5 -31
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -11
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +8 -20
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.d.ts +1 -1
- package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +9 -4
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +2 -2
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +6 -15
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +5 -11
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +7 -8
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +7 -19
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +7 -39
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +6 -29
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +2 -4
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +10 -11
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts +8 -8
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.d.ts +2 -2
- package/dist/types/src/components/Lists/List.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.stories.d.ts +8 -31
- package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.d.ts +1 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts +6 -32
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts +1 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +6 -4
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +1 -1
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +6 -7
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +6 -44
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +6 -5
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +6 -41
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +7 -16
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -34
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +6 -32
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +4 -9
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +2 -8
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -12
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -44
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +3 -7
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -50
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -4
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -61
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +5 -9
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +12 -4
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +5 -11
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts +3 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/domino.d.ts +18 -0
- package/dist/types/src/util/domino.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -22
- package/src/components/Avatars/Avatar.stories.tsx +19 -10
- package/src/components/Avatars/Avatar.tsx +3 -3
- package/src/components/Avatars/AvatarGroup.stories.tsx +10 -6
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +16 -11
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Buttons/Button.stories.tsx +10 -11
- package/src/components/Buttons/IconButton.stories.tsx +11 -8
- package/src/components/Buttons/IconButton.tsx +4 -3
- package/src/components/Buttons/Toggle.stories.tsx +12 -9
- package/src/components/Buttons/ToggleGroup.stories.tsx +13 -10
- package/src/components/Buttons/ToggleGroup.tsx +17 -4
- package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
- package/src/components/Clipboard/CopyButton.tsx +3 -2
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialogs/AlertDialog.stories.tsx +14 -11
- package/src/components/Dialogs/AlertDialog.tsx +13 -13
- package/src/components/Dialogs/Dialog.stories.tsx +16 -14
- package/src/components/Dialogs/Dialog.tsx +13 -13
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +12 -14
- package/src/components/Input/Input.tsx +16 -16
- package/src/components/Link/Link.stories.tsx +10 -6
- package/src/components/Lists/List.stories.tsx +22 -20
- package/src/components/Lists/List.tsx +15 -16
- package/src/components/Lists/Tree.stories.tsx +11 -8
- package/src/components/Lists/Tree.tsx +4 -3
- package/src/components/Lists/TreeDropIndicator.tsx +1 -1
- package/src/components/Lists/Treegrid.stories.tsx +12 -6
- package/src/components/Lists/Treegrid.tsx +2 -2
- package/src/components/Main/Main.stories.tsx +16 -8
- package/src/components/Main/Main.tsx +16 -10
- package/src/components/Menus/ContextMenu.stories.tsx +11 -8
- package/src/components/Menus/ContextMenu.tsx +1 -0
- package/src/components/Menus/DropdownMenu.stories.tsx +11 -8
- package/src/components/Menus/DropdownMenu.tsx +23 -13
- package/src/components/Message/Message.stories.tsx +11 -7
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +11 -8
- package/src/components/Popover/Popover.tsx +9 -9
- package/src/components/ScrollArea/ScrollArea.stories.tsx +11 -8
- package/src/components/ScrollArea/ScrollArea.tsx +4 -4
- package/src/components/Select/Select.stories.tsx +15 -12
- package/src/components/Select/Select.tsx +5 -5
- package/src/components/Status/Status.stories.tsx +9 -6
- package/src/components/Tag/Tag.stories.tsx +18 -9
- package/src/components/ThemeProvider/ThemeProvider.tsx +3 -2
- package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -3
- package/src/components/Toast/Toast.stories.tsx +11 -8
- package/src/components/Toast/Toast.tsx +9 -9
- package/src/components/Toolbar/Toolbar.stories.tsx +20 -16
- package/src/components/Toolbar/Toolbar.tsx +3 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +15 -11
- package/src/components/Tooltip/Tooltip.tsx +5 -4
- package/src/hooks/useSafeArea.ts +1 -0
- package/src/hooks/useSafeCollisionPadding.ts +1 -1
- package/src/hooks/useVisualViewport.ts +3 -3
- package/src/playground/Controls.stories.tsx +20 -17
- package/src/playground/Custom.stories.tsx +7 -16
- package/src/playground/Typography.stories.tsx +8 -6
- package/src/testing/decorators/withTheme.tsx +31 -0
- package/src/util/domino.ts +51 -0
- package/src/util/index.ts +2 -1
- package/dist/lib/browser/chunk-T6YPS45E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TYVQJ4KW.mjs.map +0 -7
- package/src/testing/decorators/withTheme.ts +0 -22
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
4
6
|
import React from 'react';
|
|
5
7
|
|
|
6
8
|
import { hues } from '@dxos/react-ui-theme';
|
|
7
|
-
import '@dxos-theme';
|
|
8
9
|
import { type ChromaticPalette, type MessageValence } from '@dxos/react-ui-types';
|
|
9
10
|
|
|
10
|
-
import { Tag } from './Tag';
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
13
|
+
import { Tag } from './Tag';
|
|
14
|
+
|
|
13
15
|
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...hues] as (ChromaticPalette | MessageValence)[];
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
const meta = {
|
|
16
18
|
title: 'ui/react-ui-core/Tag',
|
|
17
19
|
component: Tag,
|
|
18
|
-
decorators: [withTheme],
|
|
19
|
-
parameters: { chromatic: { disableSnapshot: false } },
|
|
20
|
-
} as const;
|
|
21
|
-
|
|
22
|
-
export const Default = {
|
|
23
20
|
render: () => (
|
|
24
21
|
<div role='grid' className='grid grid-cols-5 gap-2 max-is-screen-md'>
|
|
25
22
|
{palettes.map((palette) => (
|
|
@@ -29,4 +26,16 @@ export const Default = {
|
|
|
29
26
|
))}
|
|
30
27
|
</div>
|
|
31
28
|
),
|
|
32
|
-
|
|
29
|
+
decorators: [withTheme],
|
|
30
|
+
parameters: {
|
|
31
|
+
chromatic: {
|
|
32
|
+
disableSnapshot: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
} satisfies Meta<typeof Tag>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof meta>;
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {};
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createKeyborg } from 'keyborg';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { type PropsWithChildren, createContext, useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Density, type Elevation, type ThemeFunction } from '@dxos/react-ui-types';
|
|
9
9
|
|
|
10
|
-
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
11
10
|
import { type SafeAreaPadding, useSafeArea } from '../../hooks';
|
|
12
11
|
import { hasIosKeyboard } from '../../util';
|
|
13
12
|
import { DensityProvider } from '../DensityProvider';
|
|
14
13
|
import { ElevationProvider } from '../ElevationProvider';
|
|
15
14
|
|
|
15
|
+
import { TranslationsProvider, type TranslationsProviderProps } from './TranslationsProvider';
|
|
16
|
+
|
|
16
17
|
export type ThemeMode = 'dark' | 'light';
|
|
17
18
|
|
|
18
19
|
export type ThemeContextValue = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { enUS as dtLocaleEnUs
|
|
6
|
-
import i18Next, { type
|
|
7
|
-
import React, { type ReactNode,
|
|
5
|
+
import { type Locale, enUS as dtLocaleEnUs } from 'date-fns/locale';
|
|
6
|
+
import i18Next, { type Resource, type TFunction } from 'i18next';
|
|
7
|
+
import React, { type ReactNode, Suspense, createContext, useContext, useEffect, useState } from 'react';
|
|
8
8
|
import { initReactI18next, useTranslation as useI18NextTranslation } from 'react-i18next';
|
|
9
9
|
|
|
10
10
|
const initialLng = 'en-US';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
6
|
import React, { type ReactNode, useState } from 'react';
|
|
8
7
|
|
|
9
|
-
import { Toast } from './Toast';
|
|
10
8
|
import { withTheme } from '../../testing';
|
|
11
9
|
import { Button } from '../Buttons';
|
|
12
10
|
|
|
11
|
+
import { Toast } from './Toast';
|
|
12
|
+
|
|
13
13
|
type ActionTriggerProps = { altText: string; trigger: ReactNode };
|
|
14
14
|
|
|
15
15
|
type StorybookToastProps = Partial<{
|
|
@@ -44,15 +44,18 @@ const DefaultStory = ({ title, description, actionTriggers, openTrigger, closeTr
|
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const meta = {
|
|
48
48
|
title: 'ui/react-ui-core/Toast',
|
|
49
|
-
component: Toast,
|
|
49
|
+
component: Toast as any,
|
|
50
50
|
render: DefaultStory,
|
|
51
51
|
decorators: [withTheme],
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
|
|
56
|
+
type Story = StoryObj<typeof meta>;
|
|
54
57
|
|
|
55
|
-
export const Default = {
|
|
58
|
+
export const Default: Story = {
|
|
56
59
|
args: {
|
|
57
60
|
openTrigger: 'Open toast',
|
|
58
61
|
title: 'This is a toast',
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import {
|
|
8
|
+
ToastAction as ToastActionPrimitive,
|
|
9
|
+
type ToastActionProps as ToastActionPrimitiveProps,
|
|
10
|
+
ToastClose as ToastClosePrimitive,
|
|
11
|
+
type ToastCloseProps as ToastClosePrimitiveProps,
|
|
12
|
+
ToastDescription as ToastDescriptionPrimitive,
|
|
13
|
+
type ToastDescriptionProps as ToastDescriptionPrimitiveProps,
|
|
8
14
|
ToastProvider as ToastProviderPrimitive,
|
|
9
15
|
type ToastProviderProps as ToastProviderPrimitiveProps,
|
|
10
|
-
ToastViewport as ToastViewportPrimitive,
|
|
11
|
-
type ToastViewportProps as ToastViewportPrimitiveProps,
|
|
12
16
|
Root as ToastRootPrimitive,
|
|
13
17
|
type ToastProps as ToastRootPrimitiveProps,
|
|
14
18
|
ToastTitle as ToastTitlePrimitive,
|
|
15
19
|
type ToastTitleProps as ToastTitlePrimitiveProps,
|
|
16
|
-
|
|
17
|
-
type
|
|
18
|
-
ToastAction as ToastActionPrimitive,
|
|
19
|
-
type ToastActionProps as ToastActionPrimitiveProps,
|
|
20
|
-
ToastClose as ToastClosePrimitive,
|
|
21
|
-
type ToastCloseProps as ToastClosePrimitiveProps,
|
|
20
|
+
ToastViewport as ToastViewportPrimitive,
|
|
21
|
+
type ToastViewportProps as ToastViewportPrimitiveProps,
|
|
22
22
|
} from '@radix-ui/react-toast';
|
|
23
|
-
import React, { type ComponentPropsWithRef,
|
|
23
|
+
import React, { type ComponentPropsWithRef, type FunctionComponent, forwardRef } from 'react';
|
|
24
24
|
|
|
25
25
|
import { useThemeContext } from '../../hooks';
|
|
26
26
|
import { type ThemedClassName } from '../../util';
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { ArrowClockwise, Bug, FileJs, FileTs, TextB, TextItalic, TextUnderline } from '@phosphor-icons/react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import { Toolbar } from './Toolbar';
|
|
11
8
|
import { withTheme } from '../../testing';
|
|
12
9
|
import { Toggle } from '../Buttons';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
13
11
|
import { Select } from '../Select';
|
|
14
12
|
|
|
13
|
+
import { Toolbar } from './Toolbar';
|
|
14
|
+
|
|
15
15
|
type StorybookToolbarProps = {};
|
|
16
16
|
|
|
17
17
|
const DefaultStory = (props: StorybookToolbarProps) => {
|
|
@@ -29,6 +29,7 @@ const DefaultStory = (props: StorybookToolbarProps) => {
|
|
|
29
29
|
<Select.Option value={'b'}>B</Select.Option>
|
|
30
30
|
<Select.Option value={'c'}>C</Select.Option>
|
|
31
31
|
</Select.Viewport>
|
|
32
|
+
<Select.Arrow />
|
|
32
33
|
</Select.Content>
|
|
33
34
|
</Select.Portal>
|
|
34
35
|
</Select.Root>
|
|
@@ -37,46 +38,49 @@ const DefaultStory = (props: StorybookToolbarProps) => {
|
|
|
37
38
|
{/* TODO(burdon): Icon sizes should adapt to density. */}
|
|
38
39
|
<Toolbar.ToggleGroup type='multiple'>
|
|
39
40
|
<Toolbar.ToggleGroupItem value='a'>
|
|
40
|
-
<
|
|
41
|
+
<Icon icon='ph--text-b--regular' />
|
|
41
42
|
</Toolbar.ToggleGroupItem>
|
|
42
43
|
<Toolbar.ToggleGroupItem value='b'>
|
|
43
|
-
<
|
|
44
|
+
<Icon icon='ph--text-italic--regular' />
|
|
44
45
|
</Toolbar.ToggleGroupItem>
|
|
45
46
|
<Toolbar.ToggleGroupItem value='c'>
|
|
46
|
-
<
|
|
47
|
+
<Icon icon='ph--text-underline--regular' />
|
|
47
48
|
</Toolbar.ToggleGroupItem>
|
|
48
49
|
</Toolbar.ToggleGroup>
|
|
49
50
|
{/* TODO(burdon): Highlight isn't shown. */}
|
|
50
51
|
<Toolbar.ToggleGroup type='single' defaultValue='a'>
|
|
51
52
|
<Toolbar.ToggleGroupItem value='a'>
|
|
52
|
-
<
|
|
53
|
+
<Icon icon='ph--file-ts--regular' />
|
|
53
54
|
</Toolbar.ToggleGroupItem>
|
|
54
55
|
<Toolbar.ToggleGroupItem value='b'>
|
|
55
|
-
<
|
|
56
|
+
<Icon icon='ph--file-js--regular' />
|
|
56
57
|
</Toolbar.ToggleGroupItem>
|
|
57
58
|
</Toolbar.ToggleGroup>
|
|
58
59
|
<Toolbar.Button asChild>
|
|
59
60
|
<Toggle>
|
|
60
|
-
<
|
|
61
|
+
<Icon icon='ph--bug--regular' />
|
|
61
62
|
</Toggle>
|
|
62
63
|
</Toolbar.Button>
|
|
63
64
|
<Toolbar.Separator />
|
|
64
65
|
<Toolbar.Button>Test</Toolbar.Button>
|
|
65
66
|
<Toolbar.Button>
|
|
66
|
-
<
|
|
67
|
+
<Icon icon='ph--arrow-clockwise--regular' />
|
|
67
68
|
</Toolbar.Button>
|
|
68
69
|
</Toolbar.Root>
|
|
69
70
|
);
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
const meta = {
|
|
73
74
|
title: 'ui/react-ui-core/Toolbar',
|
|
74
|
-
component: Toolbar,
|
|
75
|
+
component: Toolbar as any,
|
|
75
76
|
render: DefaultStory,
|
|
76
77
|
decorators: [withTheme],
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
79
|
+
|
|
80
|
+
export default meta;
|
|
81
|
+
|
|
82
|
+
type Story = StoryObj<typeof meta>;
|
|
79
83
|
|
|
80
|
-
export const Default = {
|
|
84
|
+
export const Default: Story = {
|
|
81
85
|
args: {},
|
|
82
86
|
};
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
ButtonGroup,
|
|
14
14
|
type ButtonGroupProps,
|
|
15
15
|
type ButtonProps,
|
|
16
|
+
IconButton,
|
|
17
|
+
type IconButtonProps,
|
|
16
18
|
Toggle,
|
|
17
19
|
type ToggleGroupItemProps,
|
|
18
20
|
type ToggleProps,
|
|
19
|
-
IconButton,
|
|
20
|
-
type IconButtonProps,
|
|
21
21
|
} from '../Buttons';
|
|
22
22
|
import { Link, type LinkProps } from '../Link';
|
|
23
23
|
import { Separator, type SeparatorProps } from '../Separator';
|
|
@@ -30,6 +30,7 @@ const ToolbarRoot = forwardRef<HTMLDivElement, ToolbarRootProps>(
|
|
|
30
30
|
return (
|
|
31
31
|
<ToolbarPrimitive.Root
|
|
32
32
|
{...props}
|
|
33
|
+
data-arrow-keys={props.orientation === 'vertical' ? 'up down' : 'left right'}
|
|
33
34
|
className={tx('toolbar.root', 'toolbar', { layoutManaged }, classNames)}
|
|
34
35
|
ref={forwardedRef}
|
|
35
36
|
>
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
|
|
10
|
-
import { Tooltip } from './Tooltip';
|
|
11
10
|
import { withTheme } from '../../testing';
|
|
12
11
|
import { Button } from '../Buttons';
|
|
13
12
|
|
|
13
|
+
import { Tooltip } from './Tooltip';
|
|
14
|
+
|
|
14
15
|
type StoryProps = {
|
|
15
16
|
tooltips: { label: string; content: string }[];
|
|
16
17
|
defaultOpen?: boolean;
|
|
@@ -28,15 +29,18 @@ const DefaultStory = ({ tooltips, defaultOpen }: StoryProps) => (
|
|
|
28
29
|
</Tooltip.Provider>
|
|
29
30
|
);
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
const meta = {
|
|
32
33
|
title: 'ui/react-ui-core/Tooltip',
|
|
33
|
-
component: Tooltip,
|
|
34
|
+
component: Tooltip as any,
|
|
34
35
|
render: DefaultStory,
|
|
35
36
|
decorators: [withTheme],
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
38
42
|
|
|
39
|
-
export const Default = {
|
|
43
|
+
export const Default: Story = {
|
|
40
44
|
args: {
|
|
41
45
|
tooltips: [
|
|
42
46
|
{
|
|
@@ -50,9 +54,9 @@ export const Default = {
|
|
|
50
54
|
},
|
|
51
55
|
};
|
|
52
56
|
|
|
53
|
-
export const DefaultOpen = {
|
|
57
|
+
export const DefaultOpen: Story = {
|
|
54
58
|
args: {
|
|
55
|
-
|
|
59
|
+
defaultOpen: true,
|
|
56
60
|
tooltips: [
|
|
57
61
|
{
|
|
58
62
|
label: 'Tooltip trigger',
|
|
@@ -65,9 +69,9 @@ export const DefaultOpen = {
|
|
|
65
69
|
},
|
|
66
70
|
};
|
|
67
71
|
|
|
68
|
-
export const StressTest = {
|
|
72
|
+
export const StressTest: Story = {
|
|
69
73
|
args: {
|
|
70
|
-
|
|
74
|
+
defaultOpen: true,
|
|
71
75
|
tooltips: faker.helpers.multiple(
|
|
72
76
|
() => ({
|
|
73
77
|
label: faker.lorem.words(2),
|
|
@@ -11,7 +11,7 @@ import type { Scope } from '@radix-ui/react-context';
|
|
|
11
11
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
12
12
|
import { useId } from '@radix-ui/react-id';
|
|
13
13
|
import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
14
|
-
import {
|
|
14
|
+
import { type PopperAnchorProps, createPopperScope } from '@radix-ui/react-popper';
|
|
15
15
|
import { Portal as PortalPrimitive } from '@radix-ui/react-portal';
|
|
16
16
|
import { Presence } from '@radix-ui/react-presence';
|
|
17
17
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
@@ -23,10 +23,11 @@ import React, {
|
|
|
23
23
|
type ComponentPropsWithoutRef,
|
|
24
24
|
type ElementRef,
|
|
25
25
|
type FC,
|
|
26
|
-
type SyntheticEvent,
|
|
27
|
-
forwardRef,
|
|
28
26
|
type MutableRefObject,
|
|
29
27
|
type ReactNode,
|
|
28
|
+
type RefObject,
|
|
29
|
+
type SyntheticEvent,
|
|
30
|
+
forwardRef,
|
|
30
31
|
useCallback,
|
|
31
32
|
useEffect,
|
|
32
33
|
useMemo,
|
|
@@ -218,7 +219,7 @@ const TooltipProvider: FC<TooltipProviderProps> = (props: TooltipScopedProps<Too
|
|
|
218
219
|
{content}
|
|
219
220
|
<TooltipArrow className={tx('tooltip.arrow', 'tooltip__arrow')} />
|
|
220
221
|
</TooltipContent>
|
|
221
|
-
<TooltipVirtualTrigger virtualRef={triggerRef} />
|
|
222
|
+
<TooltipVirtualTrigger virtualRef={triggerRef as RefObject<HTMLButtonElement>} />
|
|
222
223
|
{children}
|
|
223
224
|
</TooltipContextProvider>
|
|
224
225
|
</PopperPrimitive.Root>
|
package/src/hooks/useSafeArea.ts
CHANGED
|
@@ -21,7 +21,7 @@ const safePadding = (
|
|
|
21
21
|
) => {
|
|
22
22
|
return (
|
|
23
23
|
(propIsNumber(safePadding[side]) ? safePadding[side] : 0) +
|
|
24
|
-
(propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? propsPadding[side] ?? 0 : 0)
|
|
24
|
+
(propIsNumber(propsPadding) ? propsPadding : propsIsRecord(propsPadding) ? (propsPadding[side] ?? 0) : 0)
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useCallback,
|
|
5
|
+
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useResize } from '@dxos/react-hooks';
|
|
8
8
|
|
|
9
|
-
export const useVisualViewport = (deps?: Parameters<typeof
|
|
9
|
+
export const useVisualViewport = (deps?: Parameters<typeof useResize>[1]) => {
|
|
10
10
|
const [width, setWidth] = useState<number | null>(null);
|
|
11
11
|
const [height, setHeight] = useState<number | null>(null);
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ export const useVisualViewport = (deps?: Parameters<typeof useEffect>[1]) => {
|
|
|
17
17
|
}
|
|
18
18
|
}, []);
|
|
19
19
|
|
|
20
|
-
useResize(handleResize);
|
|
20
|
+
useResize(handleResize, deps);
|
|
21
21
|
|
|
22
22
|
return { width, height };
|
|
23
23
|
};
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { FileTs, FileJs, ArrowClockwise, Bug, TextUnderline, TextB, TextItalic } from '@phosphor-icons/react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import { Input, Select, Toggle, Toolbar } from '../components';
|
|
11
|
-
import { withTheme
|
|
8
|
+
import { Icon, Input, Select, Toggle, Toolbar } from '../components';
|
|
9
|
+
import { withTheme } from '../testing';
|
|
10
|
+
import { withSurfaceVariantsLayout } from '../testing';
|
|
12
11
|
|
|
13
12
|
const DefaultStory = () => {
|
|
14
13
|
const [checked, setChecked] = useState<boolean>(false);
|
|
@@ -29,6 +28,7 @@ const DefaultStory = () => {
|
|
|
29
28
|
<Select.Option value={'b'}>B</Select.Option>
|
|
30
29
|
<Select.Option value={'c'}>C</Select.Option>
|
|
31
30
|
</Select.Viewport>
|
|
31
|
+
<Select.Arrow />
|
|
32
32
|
</Select.Content>
|
|
33
33
|
</Select.Portal>
|
|
34
34
|
</Select.Root>
|
|
@@ -37,27 +37,27 @@ const DefaultStory = () => {
|
|
|
37
37
|
{/* TODO(burdon): Icon sizes should adapt to density. */}
|
|
38
38
|
<Toolbar.ToggleGroup type='multiple'>
|
|
39
39
|
<Toolbar.ToggleGroupItem value='a'>
|
|
40
|
-
<
|
|
40
|
+
<Icon icon='ph--text-b--regular' />
|
|
41
41
|
</Toolbar.ToggleGroupItem>
|
|
42
42
|
<Toolbar.ToggleGroupItem value='b'>
|
|
43
|
-
<
|
|
43
|
+
<Icon icon='ph--text-italic--regular' />
|
|
44
44
|
</Toolbar.ToggleGroupItem>
|
|
45
45
|
<Toolbar.ToggleGroupItem value='c'>
|
|
46
|
-
<
|
|
46
|
+
<Icon icon='ph--text-underline--regular' />
|
|
47
47
|
</Toolbar.ToggleGroupItem>
|
|
48
48
|
</Toolbar.ToggleGroup>
|
|
49
49
|
{/* TODO(burdon): Highlight isn't shown. */}
|
|
50
50
|
<Toolbar.ToggleGroup type='single' defaultValue='a'>
|
|
51
51
|
<Toolbar.ToggleGroupItem value='a'>
|
|
52
|
-
<
|
|
52
|
+
<Icon icon='ph--file-ts--regular' />
|
|
53
53
|
</Toolbar.ToggleGroupItem>
|
|
54
54
|
<Toolbar.ToggleGroupItem value='b'>
|
|
55
|
-
<
|
|
55
|
+
<Icon icon='ph--file-js--regular' />
|
|
56
56
|
</Toolbar.ToggleGroupItem>
|
|
57
57
|
</Toolbar.ToggleGroup>
|
|
58
58
|
<Toolbar.Button asChild>
|
|
59
59
|
<Toggle>
|
|
60
|
-
<
|
|
60
|
+
<Icon icon='ph--bug--regular' />
|
|
61
61
|
</Toggle>
|
|
62
62
|
</Toolbar.Button>
|
|
63
63
|
{/* TODO(burdon): Should not be 'is-full' by default. */}
|
|
@@ -71,7 +71,7 @@ const DefaultStory = () => {
|
|
|
71
71
|
</Input.Root>
|
|
72
72
|
<Toolbar.Button>Test</Toolbar.Button>
|
|
73
73
|
<Toolbar.Button>
|
|
74
|
-
<
|
|
74
|
+
<Icon icon='ph--arrow-clockwise--regular' />
|
|
75
75
|
</Toolbar.Button>
|
|
76
76
|
</Toolbar.Root>
|
|
77
77
|
<Input.Root>
|
|
@@ -81,11 +81,14 @@ const DefaultStory = () => {
|
|
|
81
81
|
);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const meta = {
|
|
85
85
|
title: 'ui/react-ui-core/Playground/Controls',
|
|
86
86
|
render: DefaultStory,
|
|
87
|
-
decorators: [withSurfaceVariantsLayout()
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
decorators: [withTheme, withSurfaceVariantsLayout()],
|
|
88
|
+
} satisfies Meta<typeof Icon>;
|
|
89
|
+
|
|
90
|
+
export default meta;
|
|
91
|
+
|
|
92
|
+
type Story = StoryObj<typeof meta>;
|
|
90
93
|
|
|
91
|
-
export const Default = {};
|
|
94
|
+
export const Default: Story = {};
|
|
@@ -2,23 +2,12 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import { Button,
|
|
8
|
+
import { Button, type ButtonProps, IconButton, Tooltip } from '../components';
|
|
11
9
|
import { withTheme } from '../testing';
|
|
12
10
|
|
|
13
|
-
// TODO(burdon): Change density to 3 or 4 sizes: (large, medium, small; or 22, 28, 32, 40)
|
|
14
|
-
// TODO(burdon): IconButton should be square if no text.
|
|
15
|
-
// TODO(burdon): IconButton icon should be auto-sized based on density.
|
|
16
|
-
|
|
17
|
-
// TODO(burdon): Remove custom padding from all Buttons.
|
|
18
|
-
|
|
19
|
-
// TODO(burdon): Forms w/ labels.
|
|
20
|
-
// TODO(burdon): Card preview with sections.
|
|
21
|
-
|
|
22
11
|
const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
23
12
|
return (
|
|
24
13
|
<Tooltip.Provider>
|
|
@@ -120,13 +109,15 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
|
|
|
120
109
|
);
|
|
121
110
|
};
|
|
122
111
|
|
|
123
|
-
const meta
|
|
112
|
+
const meta = {
|
|
124
113
|
title: 'ui/react-ui-core/Playground/Custom',
|
|
125
114
|
component: Button,
|
|
126
115
|
render: DefaultStory,
|
|
127
116
|
decorators: [withTheme],
|
|
128
|
-
parameters: {
|
|
129
|
-
|
|
117
|
+
parameters: {
|
|
118
|
+
layout: 'centered',
|
|
119
|
+
},
|
|
120
|
+
} satisfies Meta<typeof Button>;
|
|
130
121
|
|
|
131
122
|
export default meta;
|
|
132
123
|
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { withTheme } from '../testing';
|
|
@@ -43,13 +42,16 @@ const DefaultStory = () => {
|
|
|
43
42
|
);
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
const meta = {
|
|
47
46
|
title: 'ui/react-ui-core/Playground/Typography',
|
|
48
47
|
render: DefaultStory,
|
|
49
48
|
decorators: [withTheme],
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
52
54
|
|
|
53
|
-
export const Default = {
|
|
55
|
+
export const Default: Story = {
|
|
54
56
|
args: {},
|
|
55
57
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Decorator } from '@storybook/react';
|
|
6
|
+
import React, { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { defaultTx } from '@dxos/react-ui-theme';
|
|
9
|
+
|
|
10
|
+
import { type ThemeMode, ThemeProvider, Tooltip } from '../../components';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Adds theme decorator (add to preview.ts)
|
|
14
|
+
*/
|
|
15
|
+
export const withTheme: Decorator = (Story, context) => {
|
|
16
|
+
const {
|
|
17
|
+
globals: { theme },
|
|
18
|
+
parameters: { translations },
|
|
19
|
+
} = context;
|
|
20
|
+
|
|
21
|
+
// Prevent re-rendering of the story.
|
|
22
|
+
const MemoizedStory = memo(Story);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ThemeProvider tx={defaultTx} themeMode={theme as ThemeMode} resourceExtensions={translations} noCache>
|
|
26
|
+
<Tooltip.Provider>
|
|
27
|
+
<MemoizedStory />
|
|
28
|
+
</Tooltip.Provider>
|
|
29
|
+
</ThemeProvider>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
6
|
+
import { type ClassNameValue } from '@dxos/react-ui-types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Super lightweight chainable DOM builder.
|
|
10
|
+
*/
|
|
11
|
+
export class Domino<T extends HTMLElement> {
|
|
12
|
+
static of<K extends keyof HTMLElementTagNameMap>(tag: K): Domino<HTMLElementTagNameMap[K]> {
|
|
13
|
+
return new Domino<HTMLElementTagNameMap[K]>(tag);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private readonly _el: T;
|
|
17
|
+
constructor(tag: keyof HTMLElementTagNameMap) {
|
|
18
|
+
this._el = document.createElement(tag) as T;
|
|
19
|
+
}
|
|
20
|
+
classNames(...classNames: ClassNameValue[]): this {
|
|
21
|
+
this._el.className = mx(classNames);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
text(value: string): this {
|
|
25
|
+
this._el.textContent = value;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
data(key: string, value: string): this {
|
|
29
|
+
this._el.dataset[key] = value;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
style(styles: Partial<CSSStyleDeclaration>): this {
|
|
33
|
+
Object.assign(this._el.style, styles);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
attr<K extends keyof T>(key: K, value: T[K]): this {
|
|
37
|
+
(this._el as any)[key] = value;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
children<C extends HTMLElement>(...children: Domino<C>[]): this {
|
|
41
|
+
children.forEach((child) => this._el.appendChild(child.build()));
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
on(event: string, handler: (e: Event) => void): this {
|
|
45
|
+
this._el.addEventListener(event, handler);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
build(): T {
|
|
49
|
+
return this._el;
|
|
50
|
+
}
|
|
51
|
+
}
|