@prizmui/components 0.1.5 → 0.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverSurface.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA0ClD,CAAC"}
1
+ {"version":3,"file":"PopoverSurface.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/PopoverSurface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAMhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA8ClD,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "jsx-framework-test-pb/jsx-runtime";
2
- import { useContext } from 'jsx-framework-test-pb';
2
+ import { useContext, createPortal } from 'jsx-framework-test-pb';
3
3
  import { PrizmProvider } from '../PrizmProvider/PrizmProvider';
4
4
  import { ThemeContext } from '../PrizmProvider/ThemeContext';
5
5
  import { PopoverContext } from './Popover.context';
6
- import { usePopoverSurfaceBaseClass, popoverSurfaceClassNames } from './usePopoverSurfaceStyles.styles';
6
+ import { usePopoverSurfaceStyles, popoverSurfaceClassNames } from './usePopoverSurfaceStyles.styles';
7
7
  export const PopoverSurface = (props) => {
8
8
  const context = useContext(PopoverContext);
9
9
  const theme = useContext(ThemeContext);
10
- const surfaceClass = usePopoverSurfaceBaseClass();
10
+ const surfaceStyles = usePopoverSurfaceStyles();
11
11
  const { children } = props;
12
12
  // Return a reactive function — the framework calls createReactiveChild on it,
13
13
  // so the surface is added to / removed from the DOM as open.val changes.
@@ -16,19 +16,20 @@ export const PopoverSurface = (props) => {
16
16
  return null;
17
17
  const trigger = document.getElementById(context.triggerId);
18
18
  const rect = trigger?.getBoundingClientRect();
19
- return (_jsx(PrizmProvider, { theme: theme, style: {
20
- position: 'absolute',
19
+ return createPortal(_jsx(PrizmProvider, { theme: theme, style: {
20
+ position: 'fixed',
21
21
  top: '0',
22
22
  left: '0',
23
23
  right: '0',
24
24
  bottom: '0',
25
25
  zIndex: '1000000',
26
26
  backgroundColor: 'transparent',
27
- pointerEvents: 'none',
28
- }, children: _jsx("div", { className: `${popoverSurfaceClassNames.root} ${surfaceClass}`, style: {
27
+ // Catches all clicks — those outside the surface close the popover
28
+ pointerEvents: 'auto',
29
+ }, onClick: () => { context.open.val = false; }, children: _jsx("div", { className: `${popoverSurfaceClassNames.root} ${surfaceStyles.root}`, style: {
29
30
  position: 'absolute',
30
31
  top: rect ? `${rect.bottom + 8}px` : '0',
31
32
  left: rect ? `${rect.left}px` : '0',
32
- }, children: children }) }));
33
+ }, onClick: (e) => e.stopPropagation(), children: children }) }), document.body);
33
34
  });
34
35
  };
@@ -1,5 +1,5 @@
1
1
  import type { SlotClassNames } from '../../utilities';
2
2
  import type { PopoverSurfaceSlots } from './Popover.types';
3
3
  export declare const popoverSurfaceClassNames: SlotClassNames<PopoverSurfaceSlots>;
4
- export declare const usePopoverSurfaceBaseClass: (options?: import("calame").MakeResetStylesOptions) => string;
4
+ export declare const usePopoverSurfaceStyles: (options?: import("calame").MakeStylesOptions) => Record<"root", string>;
5
5
  //# sourceMappingURL=usePopoverSurfaceStyles.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePopoverSurfaceStyles.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/usePopoverSurfaceStyles.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,mBAAmB,CAExE,CAAC;AAEF,eAAO,MAAM,0BAA0B,+DAQrC,CAAC"}
1
+ {"version":3,"file":"usePopoverSurfaceStyles.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/usePopoverSurfaceStyles.styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,mBAAmB,CAExE,CAAC;AAEF,eAAO,MAAM,uBAAuB,0EASlC,CAAC"}
@@ -1,14 +1,15 @@
1
- import { makeResetStyles } from 'calame';
1
+ import { makeStyles } from 'calame';
2
2
  import { tokens } from '@prizmui/tokens';
3
3
  export const popoverSurfaceClassNames = {
4
- root: 'c-popover-surface',
4
+ root: 'c-PopoverSurface',
5
5
  };
6
- export const usePopoverSurfaceBaseClass = makeResetStyles({
7
- backgroundColor: tokens.colorNeutralBackground1,
8
- border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
9
- borderRadius: tokens.borderRadiusMedium,
10
- boxShadow: '0 8px 16px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12)',
11
- padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalM}`,
12
- minWidth: '160px',
13
- pointerEvents: 'auto',
6
+ export const usePopoverSurfaceStyles = makeStyles({
7
+ root: {
8
+ backgroundColor: tokens.colorNeutralBackground1,
9
+ border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
10
+ borderRadius: tokens.borderRadiusMedium,
11
+ boxShadow: '0 8px 16px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12)',
12
+ padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalM}`,
13
+ minWidth: '160px',
14
+ },
14
15
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prizmui/components",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,8 +14,8 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@prizmui/tokens": "0.0.5",
18
- "calame": "0.0.6"
17
+ "calame": "0.0.6",
18
+ "@prizmui/tokens": "0.0.5"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "jsx-framework-test-pb": "*"