@dxos/react-ui 0.8.3 → 0.8.4-main.f9ba587

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.
Files changed (61) hide show
  1. package/dist/lib/browser/{chunk-WXW6KSRL.mjs → chunk-T6YPS45E.mjs} +68 -68
  2. package/dist/lib/browser/chunk-T6YPS45E.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +2 -2
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +4 -4
  7. package/dist/lib/browser/testing/index.mjs.map +2 -2
  8. package/dist/lib/node-esm/{chunk-EQ7EG74H.mjs → chunk-TYVQJ4KW.mjs} +68 -68
  9. package/dist/lib/node-esm/chunk-TYVQJ4KW.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +2 -2
  11. package/dist/lib/node-esm/index.mjs.map +1 -1
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +4 -4
  14. package/dist/lib/node-esm/testing/index.mjs.map +2 -2
  15. package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
  16. package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -1
  17. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  18. package/dist/types/src/components/Clipboard/CopyButton.d.ts +4 -5
  19. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  20. package/dist/types/src/components/Clipboard/index.d.ts +2 -3
  21. package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
  22. package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
  23. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Popover/Popover.d.ts +1 -1
  25. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  26. package/dist/types/src/components/Select/Select.stories.d.ts +1 -1
  27. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
  29. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  30. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  31. package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
  32. package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
  33. package/dist/types/src/index.d.ts +1 -1
  34. package/dist/types/src/index.d.ts.map +1 -1
  35. package/dist/types/src/playground/Custom.stories.d.ts +1 -1
  36. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  37. package/dist/types/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +13 -13
  39. package/src/components/Buttons/Button.stories.tsx +1 -1
  40. package/src/components/Buttons/Button.tsx +1 -0
  41. package/src/components/Buttons/IconButton.tsx +1 -1
  42. package/src/components/Clipboard/CopyButton.tsx +10 -12
  43. package/src/components/Input/Input.stories.tsx +1 -1
  44. package/src/components/Popover/Popover.tsx +1 -1
  45. package/src/components/Select/Select.stories.tsx +1 -1
  46. package/src/components/ThemeProvider/ThemeProvider.tsx +1 -2
  47. package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -1
  48. package/src/components/ThemeProvider/index.ts +3 -1
  49. package/src/index.ts +1 -1
  50. package/src/playground/Custom.stories.tsx +1 -1
  51. package/src/testing/decorators/withSurfaceVariantsLayout.tsx +1 -1
  52. package/README.yml +0 -1
  53. package/dist/lib/browser/chunk-WXW6KSRL.mjs.map +0 -7
  54. package/dist/lib/node/chunk-3E3QKWX4.cjs +0 -4363
  55. package/dist/lib/node/chunk-3E3QKWX4.cjs.map +0 -7
  56. package/dist/lib/node/index.cjs +0 -175
  57. package/dist/lib/node/index.cjs.map +0 -7
  58. package/dist/lib/node/meta.json +0 -1
  59. package/dist/lib/node/testing/index.cjs +0 -114
  60. package/dist/lib/node/testing/index.cjs.map +0 -7
  61. package/dist/lib/node-esm/chunk-EQ7EG74H.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.f9ba587",
4
4
  "description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -72,14 +72,14 @@
72
72
  "keyborg": "^2.5.0",
73
73
  "react-i18next": "^11.18.6",
74
74
  "react-remove-scroll": "^2.6.0",
75
- "@dxos/debug": "0.8.3",
76
- "@dxos/lit-ui": "0.8.3",
77
- "@dxos/log": "0.8.3",
78
- "@dxos/react-input": "0.8.3",
79
- "@dxos/react-hooks": "0.8.3",
80
- "@dxos/react-ui-types": "0.8.3",
81
- "@dxos/react-list": "0.8.3",
82
- "@dxos/util": "0.8.3"
75
+ "@dxos/debug": "0.8.4-main.f9ba587",
76
+ "@dxos/lit-ui": "0.8.4-main.f9ba587",
77
+ "@dxos/react-hooks": "0.8.4-main.f9ba587",
78
+ "@dxos/log": "0.8.4-main.f9ba587",
79
+ "@dxos/react-input": "0.8.4-main.f9ba587",
80
+ "@dxos/react-list": "0.8.4-main.f9ba587",
81
+ "@dxos/react-ui-types": "0.8.4-main.f9ba587",
82
+ "@dxos/util": "0.8.4-main.f9ba587"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@dnd-kit/core": "^6.0.5",
@@ -91,15 +91,15 @@
91
91
  "react": "~18.2.0",
92
92
  "react-dom": "~18.2.0",
93
93
  "vite": "5.4.7",
94
- "@dxos/random": "0.8.3",
95
- "@dxos/util": "0.8.3",
96
- "@dxos/react-ui-theme": "0.8.3"
94
+ "@dxos/random": "0.8.4-main.f9ba587",
95
+ "@dxos/util": "0.8.4-main.f9ba587",
96
+ "@dxos/react-ui-theme": "0.8.4-main.f9ba587"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "@phosphor-icons/react": "^2.1.5",
100
100
  "react": "~18.2.0",
101
101
  "react-dom": "~18.2.0",
102
- "@dxos/react-ui-theme": "0.8.3"
102
+ "@dxos/react-ui-theme": "0.8.4-main.f9ba587"
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public"
@@ -5,7 +5,7 @@
5
5
  import '@dxos-theme';
6
6
 
7
7
  import { CaretLeft, CaretRight } from '@phosphor-icons/react';
8
- import { type StoryObj, type Meta } from '@storybook/react';
8
+ import { type StoryObj, type Meta } from '@storybook/react-vite';
9
9
  import React from 'react';
10
10
 
11
11
  import { Button, ButtonGroup, type ButtonProps } from './Button';
@@ -23,6 +23,7 @@ type ButtonGroupContextValue = { inGroup?: boolean };
23
23
 
24
24
  const BUTTON_GROUP_NAME = 'ButtonGroup';
25
25
  const BUTTON_NAME = 'Button';
26
+
26
27
  const [ButtonGroupProvider, useButtonGroupContext] = createContext<ButtonGroupContextValue>(BUTTON_GROUP_NAME, {
27
28
  inGroup: false,
28
29
  });
@@ -38,7 +38,7 @@ const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
38
38
  ({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
39
39
  const { tx } = useThemeContext();
40
40
  return (
41
- <Button {...props} classNames={tx('iconButton.root', 'iconButton', {}, classNames)} ref={forwardedRef}>
41
+ <Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
42
42
  <Icon icon={icon} size={size} classNames={iconClassNames} />
43
43
  <span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
44
44
  {caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
@@ -2,25 +2,24 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type IconProps } from '@phosphor-icons/react';
6
5
  import React from 'react';
7
6
 
8
7
  import { mx } from '@dxos/react-ui-theme';
9
8
 
10
9
  import { useClipboard } from './ClipboardProvider';
11
10
  import { Button, type ButtonProps, IconButton } from '../Buttons';
12
- import { Icon } from '../Icon';
11
+ import { Icon, type IconProps } from '../Icon';
13
12
  import { useTranslation } from '../ThemeProvider';
14
13
  import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
15
14
 
16
- export type CopyButtonProps = ButtonProps & {
17
- value: string;
18
- iconProps?: IconProps;
19
- };
15
+ export type CopyButtonProps = ButtonProps &
16
+ Pick<IconProps, 'size'> & {
17
+ value: string;
18
+ };
20
19
 
21
20
  const inactiveLabelStyles = 'invisible bs-px -mbe-px overflow-hidden';
22
21
 
23
- export const CopyButton = ({ value, classNames, iconProps, ...props }: CopyButtonProps) => {
22
+ export const CopyButton = ({ classNames, value, size = 5, ...props }: CopyButtonProps) => {
24
23
  const { t } = useTranslation('os');
25
24
  const { textValue, setTextValue } = useClipboard();
26
25
  const isCopied = textValue === value;
@@ -33,12 +32,11 @@ export const CopyButton = ({ value, classNames, iconProps, ...props }: CopyButto
33
32
  >
34
33
  <div role='none' className={mx('flex gap-1 items-center', isCopied && inactiveLabelStyles)}>
35
34
  <span className='pli-1'>{t('copy label')}</span>
36
- {/* TODO(wittjosiah): Why do these need as any? */}
37
- <Icon icon='ph--copy--regular' size={5 as any} {...iconProps} />
35
+ <Icon icon='ph--copy--regular' size={size} />
38
36
  </div>
39
37
  <div role='none' className={mx('flex gap-1 items-center', !isCopied && inactiveLabelStyles)}>
40
38
  <span className='pli-1'>{t('copy success label')}</span>
41
- <Icon icon='ph--check--regular' size={5 as any} {...iconProps} />
39
+ <Icon icon='ph--check--regular' size={size} />
42
40
  </div>
43
41
  </Button>
44
42
  );
@@ -52,7 +50,7 @@ export const CopyButtonIconOnly = ({
52
50
  __scopeTooltip,
53
51
  value,
54
52
  classNames,
55
- iconProps,
53
+ size,
56
54
  variant,
57
55
  ...props
58
56
  }: TooltipScopedProps<CopyButtonIconOnlyProps>) => {
@@ -66,7 +64,7 @@ export const CopyButtonIconOnly = ({
66
64
  iconOnly
67
65
  label={label!}
68
66
  icon='ph--copy--regular'
69
- size={5}
67
+ size={size}
70
68
  variant={variant}
71
69
  classNames={['inline-flex flex-col justify-center', classNames]}
72
70
  onClick={() => setTextValue(value).then(onOpen)}
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react';
7
+ import { type StoryObj, type Meta } from '@storybook/react-vite';
8
8
  import React from 'react';
9
9
 
10
10
  import { baseSurface, modalSurface, activeSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
@@ -7,7 +7,7 @@
7
7
  import { composeEventHandlers } from '@radix-ui/primitive';
8
8
  import { useComposedRefs } from '@radix-ui/react-compose-refs';
9
9
  import { createContextScope } from '@radix-ui/react-context';
10
- import type { Scope } from '@radix-ui/react-context';
10
+ import { type Scope } from '@radix-ui/react-context';
11
11
  import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
12
12
  import { useFocusGuards } from '@radix-ui/react-focus-guards';
13
13
  import { FocusScope } from '@radix-ui/react-focus-scope';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj } from '@storybook/react';
7
+ import { type StoryObj } from '@storybook/react-vite';
8
8
  import React, { useState } from 'react';
9
9
 
10
10
  import { faker } from '@dxos/random';
@@ -13,7 +13,7 @@ import { hasIosKeyboard } from '../../util';
13
13
  import { DensityProvider } from '../DensityProvider';
14
14
  import { ElevationProvider } from '../ElevationProvider';
15
15
 
16
- export type ThemeMode = 'light' | 'dark';
16
+ export type ThemeMode = 'dark' | 'light';
17
17
 
18
18
  export type ThemeContextValue = {
19
19
  tx: ThemeFunction<any>;
@@ -54,7 +54,6 @@ export const ThemeProvider = ({
54
54
  }, []);
55
55
 
56
56
  const safeAreaPadding = useSafeArea();
57
-
58
57
  const contextValue = useMemo(
59
58
  () => ({ tx, themeMode, hasIosKeyboard: hasIosKeyboard(), safeAreaPadding, ...rest }),
60
59
  [tx, themeMode, safeAreaPadding, rest],
@@ -32,7 +32,7 @@ export const resources = {
32
32
  'loading translations': 'Loading translations…',
33
33
  },
34
34
  },
35
- } as const;
35
+ } as const satisfies Resource;
36
36
 
37
37
  void i18Next.use(initReactI18next).init({
38
38
  resources,
@@ -3,4 +3,6 @@
3
3
  //
4
4
 
5
5
  export * from './ThemeProvider';
6
- export { type Label, toLocalizedString, useTranslation, isLabel } from './TranslationsProvider';
6
+ export { type Label, isLabel, toLocalizedString, useTranslation } from './TranslationsProvider';
7
+
8
+ // TODO(burdon): Use `@internal` with barrel exports (rather than picking individual exports?)
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { type TFunction } from 'i18next';
5
+ export { type Resource, type TFunction } from 'i18next';
6
6
  export { Trans } from 'react-i18next';
7
7
 
8
8
  export * from '@dxos/react-hooks';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react';
7
+ import { type StoryObj, type Meta } from '@storybook/react-vite';
8
8
  import React from 'react';
9
9
 
10
10
  import { Button, IconButton, type ButtonProps, Tooltip } from '../components';
@@ -14,7 +14,7 @@ type Config = {
14
14
  };
15
15
 
16
16
  const Container = ({ children, elevation, surface }: PropsWithChildren<{ elevation: Elevation; surface?: string }>) => (
17
- <div className={mx('rounded-md border border-separator', surface, surfaceShadow({ elevation }))}>{children}</div>
17
+ <div className={mx('rounded-md border border-separator p-2', surface, surfaceShadow({ elevation }))}>{children}</div>
18
18
  );
19
19
 
20
20
  const Panel = ({
package/README.yml DELETED
@@ -1 +0,0 @@
1
- guideUrl: https://docs.dxos.org/guide/react/aurora/