@dxos/react-ui 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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 (51) hide show
  1. package/dist/lib/browser/{chunk-LBCJC75U.mjs → chunk-HUZZ56DW.mjs} +165 -115
  2. package/dist/lib/browser/chunk-HUZZ56DW.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +3 -1
  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 +44 -16
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/{chunk-QTUGGUCB.mjs → chunk-OJLL6E2Z.mjs} +165 -115
  9. package/dist/lib/node-esm/chunk-OJLL6E2Z.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +3 -1
  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 +44 -16
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
  16. package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
  18. package/dist/types/src/components/Main/Main.d.ts +1 -10
  19. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  20. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  21. package/dist/types/src/components/Toolbar/Toolbar.d.ts +9 -5
  22. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  23. package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
  24. package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
  25. package/dist/types/src/testing/decorators/index.d.ts +2 -1
  26. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  27. package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
  28. package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
  29. package/dist/types/src/util/domino.d.ts +1 -1
  30. package/dist/types/src/util/domino.d.ts.map +1 -1
  31. package/dist/types/src/util/index.d.ts +1 -0
  32. package/dist/types/src/util/index.d.ts.map +1 -1
  33. package/dist/types/src/util/usePx.d.ts +8 -0
  34. package/dist/types/src/util/usePx.d.ts.map +1 -0
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +16 -15
  37. package/src/components/Icon/Icon.stories.tsx +113 -0
  38. package/src/components/Icon/Icon.tsx +1 -1
  39. package/src/components/Lists/Treegrid.tsx +57 -16
  40. package/src/components/Main/Main.tsx +16 -7
  41. package/src/components/Popover/Popover.tsx +3 -3
  42. package/src/components/Toolbar/Toolbar.tsx +16 -5
  43. package/src/hooks/useSafeArea.ts +2 -2
  44. package/src/hooks/useVisualViewport.ts +3 -3
  45. package/src/testing/decorators/index.ts +2 -1
  46. package/src/testing/decorators/withLayout.tsx +56 -0
  47. package/src/util/domino.ts +6 -4
  48. package/src/util/index.ts +1 -0
  49. package/src/util/usePx.ts +61 -0
  50. package/dist/lib/browser/chunk-LBCJC75U.mjs.map +0 -7
  51. package/dist/lib/node-esm/chunk-QTUGGUCB.mjs.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/testing/decorators/withTheme.tsx", "../../../../src/testing/decorators/withSurfaceVariantsLayout.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { memo } from 'react';\n\nimport { defaultTx } from '@dxos/react-ui-theme';\n\nimport { type ThemeMode, ThemeProvider, Tooltip } from '../../components';\n\n/**\n * Adds theme decorator (add to preview.ts)\n */\nexport const withTheme: Decorator = (Story, context) => {\n const {\n globals: { theme },\n parameters: { translations },\n } = context;\n\n // Prevent re-rendering of the story.\n const MemoizedStory = memo(Story);\n\n return (\n <ThemeProvider tx={defaultTx} themeMode={theme as ThemeMode} resourceExtensions={translations} noCache>\n <Tooltip.Provider>\n <MemoizedStory />\n </Tooltip.Provider>\n </ThemeProvider>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { type ComponentType, type PropsWithChildren } from 'react';\n\nimport { mx, surfaceShadow } from '@dxos/react-ui-theme';\nimport { type Density, type Elevation } from '@dxos/react-ui-types';\n\ntype Config = {\n elevations?: { elevation: Elevation; surface?: string }[];\n densities?: Density[];\n};\n\nconst Container = ({ children, elevation, surface }: PropsWithChildren<{ elevation: Elevation; surface?: string }>) => (\n <div className={mx('rounded-md border border-separator p-2', surface, surfaceShadow({ elevation }))}>{children}</div>\n);\n\nconst Panel = ({\n Story,\n elevations,\n densities,\n className,\n}: { Story: ComponentType } & Config & { className?: string }) => (\n <div className={mx('flex flex-col h-full p-4 gap-4', className)}>\n {elevations?.map(({ elevation, surface }) =>\n densities?.map((density) => (\n <Container key={`${elevation}--${density}`} surface={surface} elevation={elevation}>\n <Story />\n </Container>\n )),\n )}\n </div>\n);\n\nexport const withSurfaceVariantsLayout = ({\n elevations = [\n { elevation: 'base', surface: 'bg-baseSurface' },\n { elevation: 'positioned', surface: 'bg-cardSurface' },\n { elevation: 'dialog', surface: 'bg-modalSurface' },\n ],\n densities = ['coarse'],\n}: Config = {}): Decorator => {\n return (Story) => (\n <div className='fixed inset-0 grid grid-cols-2 overflow-y-auto'>\n <Panel Story={Story} className='light' elevations={elevations} densities={densities} />\n <Panel Story={Story} className='dark' elevations={elevations} densities={densities} />\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;AAKA,OAAOA,SAASC,YAAY;AAE5B,SAASC,iBAAiB;AAOnB,IAAMC,YAAuB,CAACC,OAAOC,YAAAA;AAC1C,QAAM,EACJC,SAAS,EAAEC,MAAK,GAChBC,YAAY,EAAEC,aAAY,EAAE,IAC1BJ;AAGJ,QAAMK,gBAAgBC,qBAAKP,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"names": ["React", "memo", "defaultTx", "withTheme", "Story", "context", "globals", "theme", "parameters", "translations", "MemoizedStory", "memo", "ThemeProvider", "tx", "defaultTx", "themeMode", "resourceExtensions", "noCache", "Tooltip", "Provider", "React", "mx", "surfaceShadow", "Container", "children", "elevation", "surface", "React", "div", "className", "mx", "surfaceShadow", "Panel", "Story", "elevations", "densities", "map", "density", "key", "withSurfaceVariantsLayout"]
3
+ "sources": ["../../../../src/testing/decorators/withLayout.tsx", "../../../../src/testing/decorators/withSurfaceVariantsLayout.tsx", "../../../../src/testing/decorators/withTheme.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { type FC, type PropsWithChildren } from 'react';\n\nimport { type ClassNameValue, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nexport type ContainerProps = ThemedClassName<PropsWithChildren>;\n\nexport type ContainerType = 'default' | 'column';\n\nexport type WithLayoutProps =\n | FC<ContainerProps>\n | { classNames?: ClassNameValue; container?: ContainerType; scroll?: boolean };\n\n/**\n * Adds layout container.\n */\nexport const withLayout =\n (props: WithLayoutProps): Decorator =>\n (Story) => {\n if (typeof props === 'function') {\n const Container = props;\n return (\n <Container>\n <Story />\n </Container>\n );\n }\n\n const Container = layouts[(props as any).container as ContainerType] ?? layouts.default;\n return (\n <Container classNames={mx(props.classNames, props.scroll ? 'overflow-y-auto' : 'overflow-hidden')}>\n <Story />\n </Container>\n );\n };\n\nconst layouts: Record<ContainerType, FC<ContainerProps>> = {\n default: ({ children, classNames }: ContainerProps) => (\n <div role='none' className={mx(classNames)}>\n {children}\n </div>\n ),\n\n column: ({ children, classNames }: ContainerProps) => (\n <div role='none' className='fixed inset-0 flex justify-center overflow-hidden bg-deckSurface'>\n <div role='none' className={mx('flex flex-col is-[40rem] bg-baseSurface', classNames)}>\n {children}\n </div>\n </div>\n ),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { type ComponentType, type PropsWithChildren } from 'react';\n\nimport { mx, surfaceShadow } from '@dxos/react-ui-theme';\nimport { type Density, type Elevation } from '@dxos/react-ui-types';\n\ntype Config = {\n elevations?: { elevation: Elevation; surface?: string }[];\n densities?: Density[];\n};\n\nconst Container = ({ children, elevation, surface }: PropsWithChildren<{ elevation: Elevation; surface?: string }>) => (\n <div className={mx('rounded-md border border-separator p-2', surface, surfaceShadow({ elevation }))}>{children}</div>\n);\n\nconst Panel = ({\n Story,\n elevations,\n densities,\n className,\n}: { Story: ComponentType } & Config & { className?: string }) => (\n <div className={mx('flex flex-col h-full p-4 gap-4', className)}>\n {elevations?.map(({ elevation, surface }) =>\n densities?.map((density) => (\n <Container key={`${elevation}--${density}`} surface={surface} elevation={elevation}>\n <Story />\n </Container>\n )),\n )}\n </div>\n);\n\nexport const withSurfaceVariantsLayout = ({\n elevations = [\n { elevation: 'base', surface: 'bg-baseSurface' },\n { elevation: 'positioned', surface: 'bg-cardSurface' },\n { elevation: 'dialog', surface: 'bg-modalSurface' },\n ],\n densities = ['coarse'],\n}: Config = {}): Decorator => {\n return (Story) => (\n <div className='fixed inset-0 grid grid-cols-2 overflow-y-auto'>\n <Panel Story={Story} className='light' elevations={elevations} densities={densities} />\n <Panel Story={Story} className='dark' elevations={elevations} densities={densities} />\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { memo } from 'react';\n\nimport { defaultTx } from '@dxos/react-ui-theme';\n\nimport { type ThemeMode, ThemeProvider, Tooltip } from '../../components';\n\n/**\n * Adds theme decorator (add to preview.ts)\n */\nexport const withTheme: Decorator = (Story, context) => {\n const {\n globals: { theme },\n parameters: { translations },\n } = context;\n\n // Prevent re-rendering of the story.\n const MemoizedStory = memo(Story);\n\n return (\n <ThemeProvider tx={defaultTx} themeMode={theme as ThemeMode} resourceExtensions={translations} noCache>\n <Tooltip.Provider>\n <MemoizedStory />\n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WAAWC,QAAO,MACpCS,WAAWC,IAAI,CAACC,YACd,gBAAAV,OAAA,cAACJ,WAAAA;MAAUe,KAAK,GAAGb,SAAAA,KAAcY,OAAAA;MAAWX;MAAkBD;OAC5D,gBAAAE,OAAA,cAACM,OAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;;;;;AAOJ,IAAMM,4BAA4B,CAAC,EACxCL,aAAa;EACX;IAAET,WAAW;IAAQC,SAAS;EAAiB;EAC/C;IAAED,WAAW;IAAcC,SAAS;EAAiB;EACrD;IAAED,WAAW;IAAUC,SAAS;EAAkB;GAEpDS,YAAY;EAAC;EAAS,IACZ,CAAC,MAAC;AACZ,SAAO,CAACF,UACN,gBAAAN,OAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,gBAAAF,OAAA,cAACK,OAAAA;IAAMC;IAAcJ,WAAU;IAAQK;IAAwBC;MAC/D,gBAAAR,OAAA,cAACK,OAAAA;IAAMC;IAAcJ,WAAU;IAAOK;IAAwBC;;AAGpE;;;AC7CA,OAAOK,UAASC,YAAY;AAE5B,SAASC,iBAAiB;AAOnB,IAAMC,YAAuB,CAACC,OAAOC,YAAAA;AAC1C,QAAM,EACJC,SAAS,EAAEC,MAAK,GAChBC,YAAY,EAAEC,aAAY,EAAE,IAC1BJ;AAGJ,QAAMK,gBAAgBC,qBAAKP,KAAAA;AAE3B,SACE,gBAAAQ,OAAA,cAACC,eAAAA;IAAcC,IAAIC;IAAWC,WAAWT;IAAoBU,oBAAoBR;IAAcS,SAAAA;KAC7F,gBAAAN,OAAA,cAACO,QAAQC,UAAQ,MACf,gBAAAR,OAAA,cAACF,eAAAA,IAAAA,CAAAA,CAAAA;AAIT;",
6
+ "names": ["React", "mx", "withLayout", "props", "Story", "Container", "layouts", "container", "default", "classNames", "mx", "scroll", "children", "div", "role", "className", "column", "React", "mx", "surfaceShadow", "Container", "children", "elevation", "surface", "React", "div", "className", "mx", "surfaceShadow", "Panel", "Story", "elevations", "densities", "map", "density", "key", "withSurfaceVariantsLayout", "React", "memo", "defaultTx", "withTheme", "Story", "context", "globals", "theme", "parameters", "translations", "MemoizedStory", "memo", "React", "ThemeProvider", "tx", "defaultTx", "themeMode", "resourceExtensions", "noCache", "Tooltip", "Provider"]
7
7
  }