@knapsack/renderer-react-components 4.94.0--canary.7733.aed595b.0 → 4.94.0--canary.7768.a3d1a1f.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.
- package/dist/test-fixtures/index.d.ts +1 -0
- package/dist/test-fixtures/index.d.ts.map +1 -1
- package/dist/test-fixtures/index.js +1 -0
- package/dist/test-fixtures/index.js.map +1 -1
- package/dist/test-fixtures/union-react-node.d.ts +48 -0
- package/dist/test-fixtures/union-react-node.d.ts.map +1 -0
- package/dist/test-fixtures/union-react-node.js +15 -0
- package/dist/test-fixtures/union-react-node.js.map +1 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Mirrors the shape of GSK's `Button` icon props, where a prop is a union of a
|
|
4
|
+
* component type and `ReactNode` (`FC<…> | ReactNode`). Because `FC` is not
|
|
5
|
+
* assignable to `ReactNode`, TypeScript keeps this a real union and expands the
|
|
6
|
+
* `ReactNode` alias into its constituents — which previously caused the prop to
|
|
7
|
+
* infer as a plain string field instead of a ReactNode slot.
|
|
8
|
+
*/
|
|
9
|
+
interface UnionReactNodeProps {
|
|
10
|
+
/** Component-or-node union, like an icon slot. Should be a slot. */
|
|
11
|
+
iconLeading?: FC<{
|
|
12
|
+
className?: string;
|
|
13
|
+
}> | ReactNode;
|
|
14
|
+
/** Plain string-or-node union. Should be a slot. */
|
|
15
|
+
label?: string | ReactNode;
|
|
16
|
+
/** Bare ReactNode. Should be a slot (regression guard for the existing path). */
|
|
17
|
+
iconTrailing?: ReactNode;
|
|
18
|
+
/** Enum union — must stay a prop, NOT be treated as a slot. */
|
|
19
|
+
size?: 'sm' | 'md' | 'lg';
|
|
20
|
+
/** Enum whose value happens to be the literal "ReactNode" — must stay a prop. */
|
|
21
|
+
display?: 'ReactNode' | 'text';
|
|
22
|
+
}
|
|
23
|
+
export declare const UnionReactNode: ({ iconLeading, label, iconTrailing, size, display, }: UnionReactNodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Faithfully mirrors GSK's `Button`: the props type is itself a UNION of two
|
|
26
|
+
* interfaces (button vs. link) that share `iconLeading: FC<…> | ReactNode`.
|
|
27
|
+
* That extra union-of-interfaces level is what nests the icon prop one deeper
|
|
28
|
+
* than a plain object props type — the exact shape that must still route the
|
|
29
|
+
* icon prop to a ReactNode slot.
|
|
30
|
+
*/
|
|
31
|
+
interface IconButtonCommonProps {
|
|
32
|
+
/** Component-or-node union, like an icon slot. Should be a slot. */
|
|
33
|
+
iconLeading?: FC<{
|
|
34
|
+
className?: string;
|
|
35
|
+
}> | ReactNode;
|
|
36
|
+
/** Enum union — must stay a prop. */
|
|
37
|
+
size?: 'sm' | 'md' | 'lg';
|
|
38
|
+
}
|
|
39
|
+
interface IconButtonAsButtonProps extends IconButtonCommonProps {
|
|
40
|
+
type?: 'button' | 'submit' | 'reset';
|
|
41
|
+
}
|
|
42
|
+
interface IconButtonAsLinkProps extends IconButtonCommonProps {
|
|
43
|
+
href?: string;
|
|
44
|
+
}
|
|
45
|
+
export type UnionPropsIconButtonProps = IconButtonAsButtonProps | IconButtonAsLinkProps;
|
|
46
|
+
export declare const UnionPropsIconButton: (props: UnionPropsIconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=union-react-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union-react-node.d.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
|
2
|
+
export const UnionReactNode = ({ iconLeading, label, iconTrailing, size = 'md', display = 'text', }) => {
|
|
3
|
+
// `iconLeading` can be a component or a node; render accordingly. (Only the
|
|
4
|
+
// prop types are analyzed for the spec — the body just needs to compile.)
|
|
5
|
+
const Leading = typeof iconLeading === 'function' ? iconLeading : null;
|
|
6
|
+
const leadingNode = typeof iconLeading === 'function' ? null : iconLeading;
|
|
7
|
+
return (_jsxs("button", { type: "button", "data-size": size, "data-display": display, children: [Leading ? _jsx(Leading, {}) : leadingNode, label, iconTrailing] }));
|
|
8
|
+
};
|
|
9
|
+
export const UnionPropsIconButton = (props) => {
|
|
10
|
+
const { iconLeading, size = 'md' } = props;
|
|
11
|
+
const Leading = typeof iconLeading === 'function' ? iconLeading : null;
|
|
12
|
+
const leadingNode = typeof iconLeading === 'function' ? null : iconLeading;
|
|
13
|
+
return (_jsx("button", { type: "button", "data-size": size, children: Leading ? _jsx(Leading, {}) : leadingNode }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=union-react-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union-react-node.js","sourceRoot":"","sources":["../../src/test-fixtures/union-react-node.tsx"],"names":[],"mappings":";AAsBA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,WAAW,EACX,KAAK,EACL,YAAY,EACZ,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,MAAM,GACI,EAAE,EAAE;IACxB,4EAA4E;IAC5E,0EAA0E;IAC1E,MAAM,OAAO,GAAG,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC3E,OAAO,CACL,kBAAQ,IAAI,EAAC,QAAQ,eAAY,IAAI,kBAAgB,OAAO,aACzD,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,WAAW,EACnC,KAAK,EACL,YAAY,IACN,CACV,CAAC;AACJ,CAAC,CAAC;AAyBF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAE,EAAE;IACvE,MAAM,EAAE,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,OAAO,GAAG,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC3E,OAAO,CACL,iBAAQ,IAAI,EAAC,QAAQ,eAAY,IAAI,YAClC,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC,CAAC,CAAC,WAAW,GAC7B,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knapsack/renderer-react-components",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "4.94.0--canary.
|
|
4
|
+
"version": "4.94.0--canary.7768.a3d1a1f.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./demo-wrapper": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"lint": "eslint ./"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@knapsack/eslint-config-starter": "4.94.0--canary.
|
|
39
|
-
"@knapsack/prettier-config": "4.94.0--canary.
|
|
40
|
-
"@knapsack/types": "4.94.0--canary.
|
|
41
|
-
"@knapsack/typescript-config-starter": "4.94.0--canary.
|
|
38
|
+
"@knapsack/eslint-config-starter": "4.94.0--canary.7768.a3d1a1f.0",
|
|
39
|
+
"@knapsack/prettier-config": "4.94.0--canary.7768.a3d1a1f.0",
|
|
40
|
+
"@knapsack/types": "4.94.0--canary.7768.a3d1a1f.0",
|
|
41
|
+
"@knapsack/typescript-config-starter": "4.94.0--canary.7768.a3d1a1f.0",
|
|
42
42
|
"@types/node": "^22.19.11",
|
|
43
43
|
"@types/prop-types": "^15.7.15",
|
|
44
44
|
"@types/react": "^19.2.3",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"directory": "apps/client/libs/renderer-react-components",
|
|
57
57
|
"type": "git"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "a3d1a1f6283ee87d79615deba5633add002eaccd"
|
|
60
60
|
}
|