@stackshift-ui/system 6.1.0-beta.1 → 6.1.0-beta.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/dist/chunk-ERVYSKOW.mjs +16 -0
- package/dist/chunk-I4UO43BV.mjs +19 -0
- package/dist/chunk-L42GWH2C.mjs +15 -0
- package/dist/chunk-NWXTC57V.mjs +10 -0
- package/dist/{chunk-IV3CAAWU.mjs → chunk-THYLEZFE.mjs} +1 -1
- package/dist/chunk-Y5IQBZ3V.mjs +1 -0
- package/dist/default-component.d.ts +6 -2
- package/dist/default-component.js +1 -1
- package/dist/default-component.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/sanity-link.d.ts +29 -5
- package/dist/sanity-link.js +1 -1
- package/dist/sanity-link.mjs +1 -1
- package/package.json +2 -2
- package/src/default-component.tsx +19 -8
- package/src/sanity-link.ts +30 -6
- package/dist/chunk-JVS3FWLZ.mjs +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/system.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var ComponentContext = createContext({});
|
|
5
|
+
var StackShiftUIProvider = ({
|
|
6
|
+
components = {},
|
|
7
|
+
children
|
|
8
|
+
}) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(ComponentContext.Provider, { value: components, children });
|
|
10
|
+
};
|
|
11
|
+
var useStackShiftUIComponents = () => useContext(ComponentContext);
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
StackShiftUIProvider,
|
|
15
|
+
useStackShiftUIComponents
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/sanity-link.ts
|
|
2
|
+
function buildSanityLink(link) {
|
|
3
|
+
if (!link) return { href: "/page-not-found" };
|
|
4
|
+
if (link.type === "linkInternal" && !link.referenceType) {
|
|
5
|
+
return { href: `/${link.internalLink}`, target: "_self", rel: "noopener noreferrer" };
|
|
6
|
+
}
|
|
7
|
+
if (link.type === "linkInternal" && link.referenceType) {
|
|
8
|
+
const prefix = link.referenceType.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
|
+
return { href: `/${prefix}/${link.internalLink}`, target: "_self", rel: "noopener noreferrer" };
|
|
10
|
+
}
|
|
11
|
+
if (link.type === "linkExternal") {
|
|
12
|
+
return { href: `${link.externalLink}`, target: "_blank", rel: "noopener noreferrer" };
|
|
13
|
+
}
|
|
14
|
+
return { href: "/page-not-found" };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
buildSanityLink
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/default-component.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var DefaultComponent = React.forwardRef(
|
|
5
|
+
(props, ref) => {
|
|
6
|
+
const { as, ...restProps } = props;
|
|
7
|
+
const Component = as || "div";
|
|
8
|
+
return /* @__PURE__ */ jsx(Component, { ref, ...restProps });
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
DefaultComponent.displayName = "DefaultComponent";
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
DefaultComponent
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function t(e){return e?e.type==="linkInternal"&&!e.referenceType?{href:`/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkInternal"&&e.referenceType?{href:`/${e.referenceType.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkExternal"?{href:`${e.externalLink}`,target:"_blank",rel:"noopener noreferrer"}:{href:"/page-not-found"}:{href:"/page-not-found"}}export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"react";import{jsx as m}from"react/jsx-runtime";var a=e.forwardRef((t,o)=>{let{as:n,...p}=t;return m(n||"div",{ref:o,...p})});a.displayName="DefaultComponent";export{a};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type PolymorphicProps<T extends React.ElementType, P = {}> = P & {
|
|
3
|
+
as?: T;
|
|
4
|
+
} & Omit<React.ComponentPropsWithRef<T>, keyof P | "as">;
|
|
5
|
+
export declare const DefaultComponent: React.ForwardRefExoticComponent<Omit<PolymorphicProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>, {}>, "ref"> & React.RefAttributes<any>>;
|
|
6
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.create;var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var i=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},m=(e,t,o,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y(t))!R.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(p=c(t,n))||p.enumerable});return e};var T=(e,t,o)=>(o=e!=null?l(P(e)):{},m(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),d=e=>m(a({},"__esModule",{value:!0}),e);var C={};i(C,{DefaultComponent:()=>r});module.exports=d(C);var s=T(require("react")),f=require("react/jsx-runtime"),r=s.forwardRef((e,t)=>{let{as:o,...p}=e;return(0,f.jsx)(o||"div",{ref:t,...p})});r.displayName="DefaultComponent";0&&(module.exports={DefaultComponent});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-Y5IQBZ3V.mjs";export{a as DefaultComponent};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var i=Object.defineProperty;var
|
|
2
|
+
"use strict";var R=Object.create;var i=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of h(t))!P.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(o=L(t,r))||o.enumerable});return e};var b=(e,t,n)=>(n=e!=null?R(k(e)):{},l(t||!e||!e.__esModule?i(n,"default",{value:e,enumerable:!0}):n,e)),S=e=>l(i({},"__esModule",{value:!0}),e);var v={};T(v,{DefaultComponent:()=>p,StackShiftUIProvider:()=>g,buildSanityLink:()=>y,cn:()=>u,useStackShiftUIComponents:()=>C});module.exports=S(v);var s=require("clsx"),f=require("tailwind-merge");function u(...e){return(0,f.twMerge)((0,s.clsx)(e))}var m=b(require("react")),c=require("react/jsx-runtime"),p=m.forwardRef((e,t)=>{let{as:n,...o}=e;return(0,c.jsx)(n||"div",{ref:t,...o})});p.displayName="DefaultComponent";function y(e){return e?e.type==="linkInternal"&&!e.referenceType?{href:`/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkInternal"&&e.referenceType?{href:`/${e.referenceType.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkExternal"?{href:`${e.externalLink}`,target:"_blank",rel:"noopener noreferrer"}:{href:"/page-not-found"}:{href:"/page-not-found"}}var a=require("react"),d=(0,a.createContext)({}),g=({components:e={},children:t})=>(0,c.jsx)(d.Provider,{value:e,children:t}),C=()=>(0,a.useContext)(d);0&&(module.exports={DefaultComponent,StackShiftUIProvider,buildSanityLink,cn,useStackShiftUIComponents});
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";import{a as o}from"./chunk-ZZCEB2NX.mjs";import{a as t}from"./chunk-
|
|
2
|
+
"use strict";import{a as o}from"./chunk-ZZCEB2NX.mjs";import{a as t}from"./chunk-Y5IQBZ3V.mjs";import{a as e}from"./chunk-THYLEZFE.mjs";import{a as r,b as n}from"./chunk-7XY5RGCQ.mjs";export{t as DefaultComponent,r as StackShiftUIProvider,e as buildSanityLink,o as cn,n as useStackShiftUIComponents};
|
package/dist/sanity-link.d.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export interface LabeledRoute extends ConditionalLink {
|
|
2
|
+
ariaLabel?: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
linkTarget?: string;
|
|
5
|
+
linkType?: string;
|
|
6
|
+
_type?: string;
|
|
7
|
+
linkInternal?: any;
|
|
8
|
+
linkExternal?: any;
|
|
6
9
|
referenceType?: string;
|
|
10
|
+
multipleRoutes?: LabeledRouteWithKey[];
|
|
11
|
+
multipleInnerRoutes?: LabeledRouteWithKey[];
|
|
12
|
+
}
|
|
13
|
+
export interface ConditionalLink {
|
|
14
|
+
type?: string;
|
|
15
|
+
internalLink?: string | null;
|
|
16
|
+
externalLink?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface LabeledRouteWithKey extends LabeledRoute {
|
|
19
|
+
_key?: string;
|
|
20
|
+
image?: string;
|
|
21
|
+
alt?: string;
|
|
22
|
+
multipleRoutes?: LabeledRouteWithKey[];
|
|
23
|
+
featuredRoute?: {
|
|
24
|
+
featuredLink: LabeledRoute;
|
|
25
|
+
mainImage: {
|
|
26
|
+
image: string;
|
|
27
|
+
alt: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
routeType?: string;
|
|
7
31
|
}
|
|
8
32
|
interface SanityLink {
|
|
9
33
|
href: string;
|
package/dist/sanity-link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(e,r)=>{for(var n in r)i(e,n,{get:r[n],enumerable:!0})},u=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of o(r))!f.call(e,t)&&t!==n&&i(e,t,{get:()=>r[t],enumerable:!(a=l(r,t))||a.enumerable});return e};var s=e=>u(i({},"__esModule",{value:!0}),e);var y={};g(y,{buildSanityLink:()=>p});module.exports=s(y);function p(e){return e?e.type==="linkInternal"&&!e.referenceType?{href:`/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkInternal"&&e.referenceType?{href:`/${e.referenceType.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}/${e.internalLink}`,target:"_self",rel:"noopener noreferrer"}:e.type==="linkExternal"?{href:`${e.externalLink}`,target:"_blank",rel:"noopener noreferrer"}:{href:"/page-not-found"}:{href:"/page-not-found"}}0&&(module.exports={buildSanityLink});
|
package/dist/sanity-link.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-THYLEZFE.mjs";export{a as buildSanityLink};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/system",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"react18-loaders": "latest",
|
|
37
37
|
"clsx": "^2.1.1",
|
|
38
38
|
"tailwind-merge": "^2.5.4",
|
|
39
|
-
"@stackshift-ui/scripts": "6.1.0-beta.
|
|
39
|
+
"@stackshift-ui/scripts": "6.1.0-beta.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@types/react": "16.8 - 19",
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const Component = as;
|
|
3
|
+
type PolymorphicProps<T extends React.ElementType, P = {}> = P & { as?: T } & Omit<
|
|
4
|
+
React.ComponentPropsWithRef<T>,
|
|
5
|
+
keyof P | "as"
|
|
6
|
+
>;
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
type DefaultElement = "div";
|
|
9
|
+
|
|
10
|
+
export const DefaultComponent = React.forwardRef(
|
|
11
|
+
<T extends React.ElementType = DefaultElement>(
|
|
12
|
+
props: PolymorphicProps<T>,
|
|
13
|
+
ref: React.Ref<any>,
|
|
14
|
+
) => {
|
|
15
|
+
const { as, ...restProps } = props;
|
|
16
|
+
const Component = as || "div";
|
|
17
|
+
return <Component ref={ref} {...restProps} />;
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
DefaultComponent.displayName = "DefaultComponent";
|
package/src/sanity-link.ts
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export interface LabeledRoute extends ConditionalLink {
|
|
2
|
+
ariaLabel?: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
linkTarget?: string;
|
|
5
|
+
linkType?: string;
|
|
6
|
+
_type?: string;
|
|
7
|
+
linkInternal?: any;
|
|
8
|
+
linkExternal?: any;
|
|
7
9
|
referenceType?: string;
|
|
10
|
+
multipleRoutes?: LabeledRouteWithKey[];
|
|
11
|
+
multipleInnerRoutes?: LabeledRouteWithKey[];
|
|
12
|
+
}
|
|
13
|
+
export interface ConditionalLink {
|
|
14
|
+
type?: string;
|
|
15
|
+
internalLink?: string | null;
|
|
16
|
+
externalLink?: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface LabeledRouteWithKey extends LabeledRoute {
|
|
20
|
+
_key?: string;
|
|
21
|
+
image?: string;
|
|
22
|
+
alt?: string;
|
|
23
|
+
multipleRoutes?: LabeledRouteWithKey[];
|
|
24
|
+
featuredRoute?: {
|
|
25
|
+
featuredLink: LabeledRoute;
|
|
26
|
+
mainImage: {
|
|
27
|
+
image: string;
|
|
28
|
+
alt: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
routeType?: string;
|
|
8
32
|
}
|
|
9
33
|
|
|
10
34
|
interface SanityLink {
|
package/dist/chunk-JVS3FWLZ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";var p=o=>{let{as:t="div",...e}=o;return n(t,{...e})};export{p as a};
|