@hanzogui/dismissable 2.0.0

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Dismissable.cjs +287 -0
  3. package/dist/cjs/Dismissable.native.js +65 -0
  4. package/dist/cjs/Dismissable.native.js.map +1 -0
  5. package/dist/cjs/DismissableProps.cjs +16 -0
  6. package/dist/cjs/DismissableProps.native.js +19 -0
  7. package/dist/cjs/DismissableProps.native.js.map +1 -0
  8. package/dist/cjs/index.cjs +18 -0
  9. package/dist/cjs/index.native.js +21 -0
  10. package/dist/cjs/index.native.js.map +1 -0
  11. package/dist/esm/Dismissable.mjs +246 -0
  12. package/dist/esm/Dismissable.mjs.map +1 -0
  13. package/dist/esm/Dismissable.native.js +22 -0
  14. package/dist/esm/Dismissable.native.js.map +1 -0
  15. package/dist/esm/DismissableProps.mjs +2 -0
  16. package/dist/esm/DismissableProps.mjs.map +1 -0
  17. package/dist/esm/DismissableProps.native.js +2 -0
  18. package/dist/esm/DismissableProps.native.js.map +1 -0
  19. package/dist/esm/index.js +2 -0
  20. package/dist/esm/index.js.map +1 -0
  21. package/dist/esm/index.mjs +2 -0
  22. package/dist/esm/index.mjs.map +1 -0
  23. package/dist/esm/index.native.js +2 -0
  24. package/dist/esm/index.native.js.map +1 -0
  25. package/dist/jsx/Dismissable.mjs +246 -0
  26. package/dist/jsx/Dismissable.mjs.map +1 -0
  27. package/dist/jsx/Dismissable.native.js +65 -0
  28. package/dist/jsx/Dismissable.native.js.map +1 -0
  29. package/dist/jsx/DismissableProps.mjs +2 -0
  30. package/dist/jsx/DismissableProps.mjs.map +1 -0
  31. package/dist/jsx/DismissableProps.native.js +19 -0
  32. package/dist/jsx/DismissableProps.native.js.map +1 -0
  33. package/dist/jsx/index.js +2 -0
  34. package/dist/jsx/index.js.map +1 -0
  35. package/dist/jsx/index.mjs +2 -0
  36. package/dist/jsx/index.mjs.map +1 -0
  37. package/dist/jsx/index.native.js +21 -0
  38. package/dist/jsx/index.native.js.map +1 -0
  39. package/package.json +53 -0
  40. package/src/Dismissable.native.tsx +39 -0
  41. package/src/Dismissable.tsx +507 -0
  42. package/src/DismissableProps.tsx +63 -0
  43. package/src/index.ts +1 -0
  44. package/types/Dismissable.d.ts +42 -0
  45. package/types/Dismissable.native.d.ts +10 -0
  46. package/types/DismissableProps.d.ts +57 -0
  47. package/types/index.d.ts +2 -0
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var Dismissable_native_exports = {};
35
+ __export(Dismissable_native_exports, {
36
+ Dismissable: () => Dismissable,
37
+ DismissableBranch: () => DismissableBranch,
38
+ dispatchDiscreteCustomEvent: () => dispatchDiscreteCustomEvent,
39
+ getDismissableLayerCount: () => getDismissableLayerCount,
40
+ useDismissableLayersAbove: () => useDismissableLayersAbove,
41
+ useHasDismissableLayers: () => useHasDismissableLayers,
42
+ useIsInsideDismissable: () => useIsInsideDismissable
43
+ });
44
+ module.exports = __toCommonJS(Dismissable_native_exports);
45
+ var import_react = __toESM(require("react"), 1);
46
+ function dispatchDiscreteCustomEvent(_target, _event) {}
47
+ function getDismissableLayerCount() {
48
+ return 0;
49
+ }
50
+ function useHasDismissableLayers() {
51
+ return !1;
52
+ }
53
+ function useIsInsideDismissable(_ref) {
54
+ return !1;
55
+ }
56
+ function useDismissableLayersAbove(_ref) {
57
+ return 0;
58
+ }
59
+ var Dismissable = /* @__PURE__ */import_react.default.forwardRef(function (props, _ref) {
60
+ return props.children;
61
+ }),
62
+ DismissableBranch = /* @__PURE__ */import_react.default.forwardRef(function (props, _ref) {
63
+ return props.children;
64
+ });
65
+ //# sourceMappingURL=Dismissable.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dismissable_native_exports","__export","Dismissable","DismissableBranch","dispatchDiscreteCustomEvent","getDismissableLayerCount","useDismissableLayersAbove","useHasDismissableLayers","useIsInsideDismissable","module","exports","__toCommonJS","import_react","__toESM","require","_target","_event","_ref","default","forwardRef","props","children"],"sources":["../../src/Dismissable.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA,WAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,2BAAA,EAAAA,CAAA,KAAAA,2BAAA;EAAAC,wBAAA,EAAAA,CAAA,KAAAA,wBAAA;EAAAC,yBAAA,EAAAA,CAAA,KAAAA,yBAAA;EAAAC,uBAAA,EAAAA,CAAA,KAAAA,uBAAA;EAAAC,sBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAX,0BAAA;AAAA,IAAAY,YAAA,GAAkBC,OAAA,CAAAC,OAAA;AAEX,SAASV,4BAA4BW,OAAA,EAASC,MAAA,EAAQ,CAAC;AACvD,SAASX,yBAAA,EAA2B;EACvC,OAAO;AACX;AACO,SAASE,wBAAA,EAA0B;EACtC,OAAO;AACX;AACO,SAASC,uBAAuBS,IAAA,EAAM;EACzC,OAAO;AACX;AACO,SAASX,0BAA0BW,IAAA,EAAM;EAC5C,OAAO;AACX;AACO,IAAIf,WAAA,GAA4B,eAAAU,YAAA,CAAAM,OAAA,CAAMC,UAAA,CAAW,UAASC,KAAA,EAAOH,IAAA,EAAM;IAC1E,OAAOG,KAAA,CAAMC,QAAA;EACjB,CAAC;EACUlB,iBAAA,GAAkC,eAAAS,YAAA,CAAAM,OAAA,CAAMC,UAAA,CAAW,UAASC,KAAA,EAAOH,IAAA,EAAM;IAChF,OAAOG,KAAA,CAAMC,QAAA;EACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=DismissableProps.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ };
14
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
+ value: !0
16
+ }), mod);
17
+ var DismissableProps_exports = {};
18
+ module.exports = __toCommonJS(DismissableProps_exports);
19
+ //# sourceMappingURL=DismissableProps.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Dismissable.mjs";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./Dismissable.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ return to;
13
+ },
14
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: !0
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Dismissable.native.js"), module.exports);
21
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@hanzogui/dismissable",
3
+ "version": "2.0.0",
4
+ "source": "src/index.ts",
5
+ "files": [
6
+ "src",
7
+ "types",
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": true,
12
+ "main": "dist/cjs",
13
+ "module": "dist/esm",
14
+ "types": "./types/index.d.ts",
15
+ "exports": {
16
+ "./package.json": "./package.json",
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
21
+ "module": "./dist/esm/index.mjs",
22
+ "import": "./dist/esm/index.mjs",
23
+ "require": "./dist/cjs/index.cjs",
24
+ "default": "./dist/esm/index.mjs"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "hanzo-gui-build",
32
+ "watch": "hanzo-gui-build --watch",
33
+ "clean": "hanzo-gui-build clean",
34
+ "clean:build": "hanzo-gui-build clean:build"
35
+ },
36
+ "dependencies": {
37
+ "@hanzogui/compose-refs": "2.0.0-rc.29",
38
+ "@hanzogui/core": "2.0.0-rc.29",
39
+ "@hanzogui/helpers": "2.0.0-rc.29",
40
+ "@hanzogui/use-escape-keydown": "2.0.0-rc.29",
41
+ "@hanzogui/use-event": "2.0.0-rc.29"
42
+ },
43
+ "devDependencies": {
44
+ "@hanzogui/build": "2.0.0-rc.29",
45
+ "react": ">=19",
46
+ "react-dom": "*"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=19",
50
+ "react-dom": "*"
51
+ },
52
+ "module:jsx": "dist/jsx"
53
+ }
@@ -0,0 +1,39 @@
1
+ import React from 'react'
2
+
3
+ import type { DismissableBranchProps, DismissableProps } from './DismissableProps'
4
+
5
+ // stubs for native - dismissable is a web-only concept
6
+ export function dispatchDiscreteCustomEvent<E extends CustomEvent>(
7
+ _target: E['target'],
8
+ _event: E
9
+ ) {}
10
+
11
+ export function getDismissableLayerCount(): number {
12
+ return 0
13
+ }
14
+
15
+ export function useHasDismissableLayers(): boolean {
16
+ return false
17
+ }
18
+
19
+ export function useIsInsideDismissable(
20
+ _ref: React.RefObject<HTMLElement | null>
21
+ ): boolean {
22
+ return false
23
+ }
24
+
25
+ export function useDismissableLayersAbove(
26
+ _ref: React.RefObject<HTMLElement | null>
27
+ ): number {
28
+ return 0
29
+ }
30
+
31
+ export const Dismissable = React.forwardRef((props: DismissableProps, _ref) => {
32
+ return props.children as any
33
+ })
34
+
35
+ export const DismissableBranch = React.forwardRef(
36
+ (props: DismissableBranchProps, _ref) => {
37
+ return props.children as any
38
+ }
39
+ )