@caseparts-org/caseblocks 0.0.72 → 0.0.74
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/atoms/Link/Link.d.ts +10 -98
- package/dist/atoms/Link/Link.js +42 -44
- package/dist/atoms/Link/createLinkAdapter.d.ts +10 -0
- package/dist/atoms/Link/createLinkAdapter.js +40 -0
- package/dist/main-client.d.ts +0 -2
- package/dist/main-client.js +55 -54
- package/dist/main-server.d.ts +4 -0
- package/dist/main-server.js +22 -18
- package/package.json +1 -1
|
@@ -1,105 +1,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { HideAtProps } from '../HideAt';
|
|
3
3
|
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>, HideAtProps {
|
|
4
|
-
external?: boolean;
|
|
5
4
|
href: string;
|
|
6
|
-
children: React.ReactNode;
|
|
7
5
|
disabled?: boolean;
|
|
8
|
-
/** Skip default link styling (still applies responsive + disabled adjustments). */
|
|
9
6
|
unstyled?: boolean;
|
|
10
|
-
|
|
11
|
-
/** Signature an external router link (e.g. next/link) must satisfy */
|
|
12
|
-
export type LinkComponent = (_props: LinkProps) => JSX.Element;
|
|
13
|
-
export declare function LinkProvider({ component, children, }: {
|
|
14
|
-
component: LinkComponent;
|
|
7
|
+
external?: boolean;
|
|
15
8
|
children: React.ReactNode;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* ## Why a provider?
|
|
26
|
-
* Central injection means every internal usage of <Link /> inside the design system
|
|
27
|
-
* (e.g. in CategoryNav, MainNav, etc.) automatically adopts the host app's router
|
|
28
|
-
* without changing those components or sprinkling `as` props everywhere.
|
|
29
|
-
*
|
|
30
|
-
* ## Disabled behavior
|
|
31
|
-
* - Adds `aria-disabled`
|
|
32
|
-
* - Prevents default navigation & stops propagation
|
|
33
|
-
* - Removes from tab order (tabIndex = -1)
|
|
34
|
-
* - Applies a disabled style
|
|
35
|
-
*
|
|
36
|
-
* ## Responsive visibility
|
|
37
|
-
* Accepts `hideAt?: Breakpoint[]` (see HideAt) to conditionally hide via utility classes.
|
|
38
|
-
*
|
|
39
|
-
* ## Usage (Default / No Provider)
|
|
40
|
-
* ```tsx
|
|
41
|
-
* <Link href="/parts/123">View Part</Link>
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* ## Usage (Next.js)
|
|
45
|
-
* Create an app-level provider so all CaseBlocks links use Next.js client navigation & prefetch.
|
|
46
|
-
*
|
|
47
|
-
* ```tsx
|
|
48
|
-
* // app/providers.tsx (or pages/_app.tsx)
|
|
49
|
-
* import React from 'react';
|
|
50
|
-
* import NextLink from 'next/link';
|
|
51
|
-
* import { LinkProvider, LinkProps } from 'atoms/Link/Link';
|
|
52
|
-
*
|
|
53
|
-
* export function AppProviders({ children }: { children: React.ReactNode }) {
|
|
54
|
-
* return (
|
|
55
|
-
* <LinkProvider
|
|
56
|
-
* component={(p: LinkProps) => (
|
|
57
|
-
* // Next.js <Link> accepts anchor props like className, onClick, etc.
|
|
58
|
-
* <NextLink href={p.href} className={p.className} prefetch>
|
|
59
|
-
* {p.children}
|
|
60
|
-
* </NextLink>
|
|
61
|
-
* )}
|
|
62
|
-
* >
|
|
63
|
-
* {children}
|
|
64
|
-
* </LinkProvider>
|
|
65
|
-
* );
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* Now every internal <Link /> (e.g. in <CategoryNav />) uses Next.js routing automatically.
|
|
70
|
-
*
|
|
71
|
-
* ## Usage (react-router-dom)
|
|
72
|
-
* ```tsx
|
|
73
|
-
* import { Link as RouterLink } from 'react-router-dom';
|
|
74
|
-
* import { LinkProvider, LinkProps } from 'atoms/Link/Link';
|
|
75
|
-
*
|
|
76
|
-
* function AppProviders({ children }: { children: React.ReactNode }) {
|
|
77
|
-
* return (
|
|
78
|
-
* <LinkProvider
|
|
79
|
-
* component={({ href, children, className, ...rest }: LinkProps) => (
|
|
80
|
-
* <RouterLink to={href} className={className} {...rest}>
|
|
81
|
-
* {children}
|
|
82
|
-
* </RouterLink>
|
|
83
|
-
* )}
|
|
84
|
-
* >
|
|
85
|
-
* {children}
|
|
86
|
-
* </LinkProvider>
|
|
87
|
-
* );
|
|
88
|
-
* }
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* ## Supplying a custom implementation
|
|
92
|
-
* The injected component receives already-prepared props:
|
|
93
|
-
* - className (merged styles + responsive + disabled)
|
|
94
|
-
* - href (or "#" when disabled)
|
|
95
|
-
* - aria-disabled / tabIndex adjustments
|
|
96
|
-
* - onClick handler (prevents navigation when disabled)
|
|
97
|
-
*
|
|
98
|
-
* You normally just map `href` to your router's expected prop (`href` for Next.js, `to` for react-router).
|
|
99
|
-
*
|
|
100
|
-
* ## Edge cases / Notes
|
|
101
|
-
* - If your router component must wrap an <a>, you can still do so; styling is already on the outer element.
|
|
102
|
-
* - Do not reimplement disabled logic in the injected component (already handled).
|
|
103
|
-
* - If you need additional router-only props (e.g. prefetch={false}), extend in the adapter inside your app, not here.
|
|
104
|
-
*/
|
|
105
|
-
export declare function Link({ external, href, children, disabled, unstyled, hideAt, className, onClick, ...otherProps }: LinkProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare function linkClassName({ className, unstyled, disabled, hideAt }: {
|
|
11
|
+
className?: string;
|
|
12
|
+
unstyled?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hideAt?: HideAtProps["hideAt"];
|
|
15
|
+
}): string;
|
|
16
|
+
/** SSR‑safe base link primitive */
|
|
17
|
+
export declare function Link({ href, disabled, unstyled, external, hideAt, className, children, onClick, ...rest }: LinkProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/atoms/Link/Link.js
CHANGED
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { t as u } from "../../Text.module-Dzhzk2fH.js";
|
|
3
|
+
import { c as _ } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { getHideAtStyles as g } from "../HideAt.js";
|
|
5
|
+
import '../../assets/Link.css';const k = "_link_ygp31_1", y = "_disabled_ygp31_14", i = {
|
|
6
|
+
link: k,
|
|
7
|
+
disabled: y
|
|
8
|
+
};
|
|
9
|
+
function b({
|
|
10
|
+
className: e,
|
|
11
|
+
unstyled: t,
|
|
12
|
+
disabled: n,
|
|
13
|
+
hideAt: s
|
|
13
14
|
}) {
|
|
14
|
-
return
|
|
15
|
+
return _(
|
|
16
|
+
e,
|
|
17
|
+
!t && u["text-body"],
|
|
18
|
+
!t && i.link,
|
|
19
|
+
n && i.disabled,
|
|
20
|
+
g(s)
|
|
21
|
+
);
|
|
15
22
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
href: r,
|
|
19
|
-
children: o,
|
|
23
|
+
function S({
|
|
24
|
+
href: e,
|
|
20
25
|
disabled: t = !1,
|
|
21
|
-
unstyled:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
unstyled: n = !1,
|
|
27
|
+
external: s,
|
|
28
|
+
hideAt: l,
|
|
29
|
+
className: f,
|
|
30
|
+
children: m,
|
|
31
|
+
onClick: r,
|
|
32
|
+
...o
|
|
26
33
|
}) {
|
|
27
|
-
|
|
28
|
-
k,
|
|
29
|
-
!l && g["text-body"],
|
|
30
|
-
!l && c.link,
|
|
31
|
-
t && c.disabled,
|
|
32
|
-
y(x)
|
|
33
|
-
);
|
|
34
|
-
function d(f) {
|
|
34
|
+
function p(a) {
|
|
35
35
|
if (t) {
|
|
36
|
-
|
|
36
|
+
a.preventDefault(), a.stopPropagation();
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
r == null || r(a);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
...
|
|
43
|
-
href: t ? "#" :
|
|
44
|
-
className:
|
|
45
|
-
|
|
46
|
-
disabled: t,
|
|
47
|
-
onClick: d,
|
|
41
|
+
const c = b({ className: f, unstyled: n, disabled: t, hideAt: l }), x = {
|
|
42
|
+
...o,
|
|
43
|
+
href: t ? "#" : e,
|
|
44
|
+
className: c,
|
|
45
|
+
onClick: p,
|
|
48
46
|
"aria-disabled": t || void 0,
|
|
49
|
-
tabIndex: t ? -1 :
|
|
50
|
-
role: t ? "link" :
|
|
47
|
+
tabIndex: t ? -1 : o.tabIndex,
|
|
48
|
+
role: t ? "link" : o.role
|
|
51
49
|
};
|
|
52
|
-
return
|
|
50
|
+
return /* @__PURE__ */ d("a", { ...x, children: m });
|
|
53
51
|
}
|
|
54
52
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
S as Link,
|
|
54
|
+
b as linkClassName
|
|
57
55
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LinkProps } from './Link';
|
|
3
|
+
/** Minimal contract a router link should satisfy */
|
|
4
|
+
export type RouterLike = React.ComponentType<{
|
|
5
|
+
href: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
9
|
+
/** Build a styled, disabled-aware Link that delegates navigation to RouterLike */
|
|
10
|
+
export declare function createLinkAdapter(RouterComponent: RouterLike): ({ href, disabled, unstyled, hideAt, className, children, onClick, ...rest }: LinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { linkClassName as l } from "./Link.js";
|
|
3
|
+
function k(n) {
|
|
4
|
+
return function({
|
|
5
|
+
href: o,
|
|
6
|
+
disabled: r = !1,
|
|
7
|
+
unstyled: f = !1,
|
|
8
|
+
hideAt: p,
|
|
9
|
+
className: u,
|
|
10
|
+
children: i,
|
|
11
|
+
onClick: t,
|
|
12
|
+
...e
|
|
13
|
+
}) {
|
|
14
|
+
function m(a) {
|
|
15
|
+
if (r) {
|
|
16
|
+
a.preventDefault(), a.stopPropagation();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
t == null || t(a);
|
|
20
|
+
}
|
|
21
|
+
const x = l({ className: u, unstyled: f, disabled: r, hideAt: p });
|
|
22
|
+
return /* @__PURE__ */ c(
|
|
23
|
+
n,
|
|
24
|
+
{
|
|
25
|
+
...e,
|
|
26
|
+
href: r ? "#" : o,
|
|
27
|
+
className: x,
|
|
28
|
+
onClick: m,
|
|
29
|
+
"aria-disabled": r || void 0,
|
|
30
|
+
tabIndex: r ? -1 : e.tabIndex,
|
|
31
|
+
role: r ? "link" : e.role,
|
|
32
|
+
"data-router-adapter": "next",
|
|
33
|
+
children: i
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
k as createLinkAdapter
|
|
40
|
+
};
|
package/dist/main-client.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from './main-server';
|
|
2
|
-
export { Link, LinkProvider } from './atoms/Link/Link';
|
|
3
|
-
export type { LinkProps } from './atoms/Link/Link';
|
|
4
2
|
export { LinkButton } from './atoms/LinkButton/LinkButton';
|
|
5
3
|
export type { LinkButtonProps } from './atoms/LinkButton/LinkButton';
|
|
6
4
|
export { Image, ImageProvider } from './atoms/Image/Image';
|
package/dist/main-client.js
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
1
|
import { Button as t } from "./atoms/Button/Button.js";
|
|
2
2
|
import { Flex as p } from "./atoms/Flex/Flex.js";
|
|
3
3
|
import { Column as x, Grid as f } from "./atoms/Grid/Grid.js";
|
|
4
|
-
import { Head as
|
|
4
|
+
import { Head as n } from "./atoms/Root/Head.js";
|
|
5
5
|
import { Icon as u } from "./atoms/Icon/Icon.js";
|
|
6
|
-
import { Root as
|
|
6
|
+
import { Root as c } from "./atoms/Root/Root.js";
|
|
7
7
|
import { Separator as C } from "./atoms/Separator/Separator.js";
|
|
8
|
-
import { Text as
|
|
9
|
-
import { Input as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
8
|
+
import { Text as A } from "./atoms/Text/Text.js";
|
|
9
|
+
import { Input as B } from "./atoms/Input/Input.js";
|
|
10
|
+
import { Link as h } from "./atoms/Link/Link.js";
|
|
11
|
+
import { createLinkAdapter as L } from "./atoms/Link/createLinkAdapter.js";
|
|
12
|
+
import { Logo as T } from "./molecules/Logo/Logo.js";
|
|
13
|
+
import { SearchBox as P } from "./molecules/SearchBox/SearchBox.js";
|
|
14
|
+
import { QuantityInput as M } from "./molecules/QuantityInput/QuantityInput.js";
|
|
15
|
+
import { Pricing as b } from "./molecules/Pricing/Pricing.js";
|
|
16
|
+
import { LinkButton as w } from "./atoms/LinkButton/LinkButton.js";
|
|
17
|
+
import { Image as H, ImageProvider as Q } from "./atoms/Image/Image.js";
|
|
18
|
+
import { Tooltip as V } from "./molecules/Tooltip/Tooltip.js";
|
|
19
|
+
import { Account as q } from "./molecules/Account/Account.js";
|
|
20
|
+
import { Avatar as D } from "./molecules/Avatar/Avatar.js";
|
|
21
|
+
import { Chip as J } from "./molecules/Chip/Chip.js";
|
|
22
|
+
import { ToggleView as O } from "./molecules/ToggleView/ToggleView.js";
|
|
23
|
+
import { StatefulButton as W } from "./molecules/StatefulButton/StatefulButton.js";
|
|
24
|
+
import { AnimatedCheckMark as Y } from "./molecules/StatefulButton/AnimatedCheckmark.js";
|
|
25
|
+
import { AddToCart as _ } from "./molecules/AddToCart/AddToCart.js";
|
|
26
|
+
import { Availability as oo } from "./molecules/Availability/Availability.js";
|
|
27
|
+
import { BannerCard as to } from "./molecules/BannerCard/BannerCard.js";
|
|
28
|
+
import { MainNav as po } from "./organisms/MainNav/MainNav.js";
|
|
29
|
+
import { ChipSelector as xo } from "./organisms/ChipSelector/ChipSelector.js";
|
|
30
|
+
import { Product as ao } from "./organisms/Product/Product.js";
|
|
30
31
|
import { NotFound as io } from "./organisms/NotFound/NotFound.js";
|
|
31
|
-
import { Carousel as
|
|
32
|
-
import { Footer as
|
|
32
|
+
import { Carousel as co } from "./organisms/Carousel/Carousel.js";
|
|
33
|
+
import { Footer as Co } from "./organisms/Footer/Footer.js";
|
|
33
34
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
q as Account,
|
|
36
|
+
_ as AddToCart,
|
|
37
|
+
Y as AnimatedCheckMark,
|
|
38
|
+
oo as Availability,
|
|
39
|
+
D as Avatar,
|
|
40
|
+
to as BannerCard,
|
|
40
41
|
t as Button,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
co as Carousel,
|
|
43
|
+
J as Chip,
|
|
44
|
+
xo as ChipSelector,
|
|
44
45
|
x as Column,
|
|
45
46
|
p as Flex,
|
|
46
|
-
|
|
47
|
+
Co as Footer,
|
|
47
48
|
f as Grid,
|
|
48
|
-
|
|
49
|
+
n as Head,
|
|
49
50
|
u as Icon,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
eo as MainNav,
|
|
51
|
+
H as Image,
|
|
52
|
+
Q as ImageProvider,
|
|
53
|
+
B as Input,
|
|
54
|
+
h as Link,
|
|
55
|
+
w as LinkButton,
|
|
56
|
+
T as Logo,
|
|
57
|
+
po as MainNav,
|
|
58
58
|
io as NotFound,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
b as Pricing,
|
|
60
|
+
ao as Product,
|
|
61
|
+
M as QuantityInput,
|
|
62
|
+
c as Root,
|
|
63
|
+
P as SearchBox,
|
|
64
64
|
C as Separator,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
W as StatefulButton,
|
|
66
|
+
A as Text,
|
|
67
|
+
O as ToggleView,
|
|
68
|
+
V as Tooltip,
|
|
69
|
+
L as createLinkAdapter
|
|
69
70
|
};
|
package/dist/main-server.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export { Text } from './atoms/Text/Text';
|
|
|
13
13
|
export type { TextProps } from './atoms/Text/Text';
|
|
14
14
|
export { Input } from './atoms/Input/Input';
|
|
15
15
|
export type { InputProps } from './atoms/Input/Input';
|
|
16
|
+
export { Link } from './atoms/Link/Link';
|
|
17
|
+
export type { LinkProps } from './atoms/Link/Link';
|
|
18
|
+
export { createLinkAdapter } from './atoms/Link/createLinkAdapter';
|
|
19
|
+
export type { RouterLike } from './atoms/Link/createLinkAdapter';
|
|
16
20
|
export { Logo } from './molecules/Logo/Logo';
|
|
17
21
|
export type { LogoProps } from './molecules/Logo/Logo';
|
|
18
22
|
export { SearchBox } from './molecules/SearchBox/SearchBox';
|
package/dist/main-server.js
CHANGED
|
@@ -2,28 +2,32 @@ import { Button as t } from "./atoms/Button/Button.js";
|
|
|
2
2
|
import { Flex as p } from "./atoms/Flex/Flex.js";
|
|
3
3
|
import { Column as m, Grid as f } from "./atoms/Grid/Grid.js";
|
|
4
4
|
import { Head as a } from "./atoms/Root/Head.js";
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Root as
|
|
7
|
-
import { Separator as
|
|
8
|
-
import { Text as
|
|
9
|
-
import { Input as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
5
|
+
import { Icon as u } from "./atoms/Icon/Icon.js";
|
|
6
|
+
import { Root as d } from "./atoms/Root/Root.js";
|
|
7
|
+
import { Separator as L } from "./atoms/Separator/Separator.js";
|
|
8
|
+
import { Text as k } from "./atoms/Text/Text.js";
|
|
9
|
+
import { Input as B } from "./atoms/Input/Input.js";
|
|
10
|
+
import { Link as h } from "./atoms/Link/Link.js";
|
|
11
|
+
import { createLinkAdapter as A } from "./atoms/Link/createLinkAdapter.js";
|
|
12
|
+
import { Logo as F } from "./molecules/Logo/Logo.js";
|
|
13
|
+
import { SearchBox as H } from "./molecules/SearchBox/SearchBox.js";
|
|
14
|
+
import { QuantityInput as Q } from "./molecules/QuantityInput/QuantityInput.js";
|
|
15
|
+
import { Pricing as T } from "./molecules/Pricing/Pricing.js";
|
|
14
16
|
export {
|
|
15
17
|
t as Button,
|
|
16
18
|
m as Column,
|
|
17
19
|
p as Flex,
|
|
18
20
|
f as Grid,
|
|
19
21
|
a as Head,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
u as Icon,
|
|
23
|
+
B as Input,
|
|
24
|
+
h as Link,
|
|
25
|
+
F as Logo,
|
|
26
|
+
T as Pricing,
|
|
27
|
+
Q as QuantityInput,
|
|
28
|
+
d as Root,
|
|
29
|
+
H as SearchBox,
|
|
30
|
+
L as Separator,
|
|
31
|
+
k as Text,
|
|
32
|
+
A as createLinkAdapter
|
|
29
33
|
};
|