@telegraph/helpers 0.0.1 → 0.0.3
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/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +7 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/components/RefToTgphRef/RefToTgphRef.d.ts +5 -0
- package/dist/types/components/RefToTgphRef/RefToTgphRef.d.ts.map +1 -0
- package/dist/types/components/RefToTgphRef/index.d.ts +2 -0
- package/dist/types/components/RefToTgphRef/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/utility.d.ts +18 -1
- package/dist/types/types/utility.d.ts.map +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @telegraph/helpers
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132](https://github.com/knocklabs/telegraph/pull/132) [`8d4c7bb`](https://github.com/knocklabs/telegraph/commit/8d4c7bb5031747c185faa31c0bc0aef7bd14d01c) Thanks [@kylemcd](https://github.com/kylemcd)! - first release of new menu component
|
|
8
|
+
|
|
9
|
+
## 0.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#124](https://github.com/knocklabs/telegraph/pull/124) [`def3d89`](https://github.com/knocklabs/telegraph/commit/def3d89056aa54c0d24f74e33bc04df8efc712d9) Thanks [@kylemcd](https://github.com/kylemcd)! - better ts support for as prop with custom tgphRef
|
|
14
|
+
|
|
3
15
|
## 0.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("@radix-ui/react-slot"),c=require("react"),f=c.forwardRef((e,t)=>r.jsx(o.Slot,{...e,tgphRef:t}));exports.RefToTgphRef=f;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/RefToTgphRef/RefToTgphRef.tsx"],"sourcesContent":["//\n// When interacting with components like a Radix.Trigger, they assume that\n// our components accept a `ref` prop. This is not the case with our components\n// because we use the `tgphRef` prop instead. To work around this, we can create\n// a new component that accepts a `ref` prop and forwards it to the `tgphRef`\n// prop.\n//\nimport { Slot } from \"@radix-ui/react-slot\";\nimport React from \"react\";\n\n// We can't generate the type of the ref because it's a forwardRef so any\n// works for this use case\n//\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst RefToTgphRef = React.forwardRef<any, any>((props, ref) => {\n return <Slot {...props} tgphRef={ref} />;\n});\n\nexport { RefToTgphRef };\n"],"names":["RefToTgphRef","React","props","ref","jsx","Slot"],"mappings":"0KAcMA,EAAeC,EAAM,WAAqB,CAACC,EAAOC,IAC9CC,EAAAA,IAAAC,EAAAA,KAAA,CAAM,GAAGH,EAAO,QAASC,CAAK,CAAA,CACvC"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as f } from "@radix-ui/react-slot";
|
|
3
|
+
import e from "react";
|
|
4
|
+
const i = e.forwardRef((o, r) => /* @__PURE__ */ t(f, { ...o, tgphRef: r }));
|
|
5
|
+
export {
|
|
6
|
+
i as RefToTgphRef
|
|
7
|
+
};
|
|
2
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/components/RefToTgphRef/RefToTgphRef.tsx"],"sourcesContent":["//\n// When interacting with components like a Radix.Trigger, they assume that\n// our components accept a `ref` prop. This is not the case with our components\n// because we use the `tgphRef` prop instead. To work around this, we can create\n// a new component that accepts a `ref` prop and forwards it to the `tgphRef`\n// prop.\n//\nimport { Slot } from \"@radix-ui/react-slot\";\nimport React from \"react\";\n\n// We can't generate the type of the ref because it's a forwardRef so any\n// works for this use case\n//\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst RefToTgphRef = React.forwardRef<any, any>((props, ref) => {\n return <Slot {...props} tgphRef={ref} />;\n});\n\nexport { RefToTgphRef };\n"],"names":["RefToTgphRef","React","props","ref","jsx","Slot"],"mappings":";;;AAcA,MAAMA,IAAeC,EAAM,WAAqB,CAACC,GAAOC,MAC9C,gBAAAC,EAAAC,GAAA,EAAM,GAAGH,GAAO,SAASC,EAAK,CAAA,CACvC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefToTgphRef.d.ts","sourceRoot":"","sources":["../../../../src/components/RefToTgphRef/RefToTgphRef.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,YAAY,8EAEhB,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/RefToTgphRef/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export type { Required, AsProp, PropsWithAs, Optional } from
|
|
1
|
+
export type { Required, AsProp, PropsWithAs, Optional, PolymorphicProps, PolymorphicPropsWithTgphRef, TgphElement, TgphComponentProps, OptionalAsPropConfig, } from './types/utility';
|
|
2
|
+
export { RefToTgphRef } from './components/RefToTgphRef';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,MAAM,EACN,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,2BAA2B,EAC3B,WAAW,EACX,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
2
3
|
export type Required<T, K = Record<string, unknown>> = K extends keyof T ? Omit<T, K> & Required<Pick<T, K>> : {
|
|
3
4
|
[P in keyof T]-?: T[P];
|
|
4
5
|
};
|
|
@@ -8,5 +9,21 @@ export type Optional<T, K extends keyof T> = K extends keyof T ? Omit<T, K> & Pa
|
|
|
8
9
|
export type AsProp<C extends React.ElementType> = {
|
|
9
10
|
as?: C;
|
|
10
11
|
};
|
|
12
|
+
export type OptionalAsPropConfig<E extends React.ElementType> = {
|
|
13
|
+
as?: E;
|
|
14
|
+
internal_optionalAs: true;
|
|
15
|
+
} | {
|
|
16
|
+
as: E;
|
|
17
|
+
internal_optionalAs?: never;
|
|
18
|
+
};
|
|
11
19
|
export type PropsWithAs<C extends React.ElementType, P> = AsProp<C> & Omit<React.ComponentProps<C>, keyof AsProp<C>> & P;
|
|
20
|
+
export type PolymorphicProps<E extends React.ElementType> = Omit<React.ComponentProps<E>, "as"> & {
|
|
21
|
+
as?: E;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export type PolymorphicPropsWithTgphRef<E extends React.ElementType, R extends HTMLElement | React.ElementType> = {
|
|
25
|
+
tgphRef?: React.Ref<R>;
|
|
26
|
+
} & PolymorphicProps<E>;
|
|
27
|
+
export type TgphComponentProps<T extends React.ElementType> = React.ComponentProps<T>;
|
|
28
|
+
export type TgphElement = React.ElementType;
|
|
12
29
|
//# sourceMappingURL=utility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../src/types/utility.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../src/types/utility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GACpE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACjC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAG/B,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAC1D,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAChC;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAK9B,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI;IAChD,EAAE,CAAC,EAAE,CAAC,CAA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|
4
4
|
"repository": "https://github.com/knocklabs/telegraph/tree/main/packages/helpers",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,17 +29,20 @@
|
|
|
29
29
|
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check",
|
|
30
30
|
"preview": "vite preview"
|
|
31
31
|
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@radix-ui/react-slot": "^1.0.2"
|
|
34
|
+
},
|
|
32
35
|
"devDependencies": {
|
|
33
36
|
"@knocklabs/eslint-config": "^0.0.3",
|
|
34
37
|
"@knocklabs/typescript-config": "^0.0.2",
|
|
35
38
|
"@telegraph/prettier-config": "^0.0.6",
|
|
36
|
-
"@telegraph/vite-config": "^0.0.
|
|
39
|
+
"@telegraph/vite-config": "^0.0.9",
|
|
37
40
|
"@types/react": "^18.2.48",
|
|
38
41
|
"eslint": "^8.56.0",
|
|
39
42
|
"react": "^18.2.0",
|
|
40
43
|
"react-dom": "^18.2.0",
|
|
41
44
|
"typescript": "^5.3.3",
|
|
42
|
-
"vite": "^5.0
|
|
45
|
+
"vite": "^5.3.0"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
48
|
"react": "^18.2.0",
|